@tanrei/web 0.0.0-stage → 0.1.0-next.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 (781) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +58 -0
  3. package/README.md +9743 -2
  4. package/custom-elements.json +86072 -0
  5. package/dist/THIRD_PARTY_LICENSES.md +136 -0
  6. package/dist/accordion.css +812 -0
  7. package/dist/app-shell.css +493 -0
  8. package/dist/avatar.css +80 -0
  9. package/dist/breadcrumbs.css +511 -0
  10. package/dist/callout.css +65 -0
  11. package/dist/code.css +595 -0
  12. package/dist/components/accordion/accordion.d.ts +197 -0
  13. package/dist/components/accordion/accordion.js +763 -0
  14. package/dist/components/accordion/accordion.js.map +1 -0
  15. package/dist/components/app-bar/app-bar.d.ts +107 -0
  16. package/dist/components/app-bar/app-bar.js +295 -0
  17. package/dist/components/app-bar/app-bar.js.map +1 -0
  18. package/dist/components/app-bar/app-bar.styles.d.ts +12 -0
  19. package/dist/components/app-bar/app-bar.styles.js +223 -0
  20. package/dist/components/app-bar/app-bar.styles.js.map +1 -0
  21. package/dist/components/app-shell/app-shell.d.ts +220 -0
  22. package/dist/components/app-shell/app-shell.js +677 -0
  23. package/dist/components/app-shell/app-shell.js.map +1 -0
  24. package/dist/components/avatar/avatar.d.ts +162 -0
  25. package/dist/components/avatar/avatar.js +390 -0
  26. package/dist/components/avatar/avatar.js.map +1 -0
  27. package/dist/components/avatar/avatar.styles.d.ts +9 -0
  28. package/dist/components/avatar/avatar.styles.js +258 -0
  29. package/dist/components/avatar/avatar.styles.js.map +1 -0
  30. package/dist/components/badge/badge.d.ts +59 -0
  31. package/dist/components/badge/badge.js +176 -0
  32. package/dist/components/badge/badge.js.map +1 -0
  33. package/dist/components/badge/badge.styles.d.ts +1 -0
  34. package/dist/components/badge/badge.styles.js +106 -0
  35. package/dist/components/badge/badge.styles.js.map +1 -0
  36. package/dist/components/bottom-sheet/bottom-sheet.d.ts +207 -0
  37. package/dist/components/bottom-sheet/bottom-sheet.js +724 -0
  38. package/dist/components/bottom-sheet/bottom-sheet.js.map +1 -0
  39. package/dist/components/bottom-sheet/bottom-sheet.styles.d.ts +1 -0
  40. package/dist/components/bottom-sheet/bottom-sheet.styles.js +393 -0
  41. package/dist/components/bottom-sheet/bottom-sheet.styles.js.map +1 -0
  42. package/dist/components/breadcrumbs/breadcrumbs.d.ts +176 -0
  43. package/dist/components/breadcrumbs/breadcrumbs.js +638 -0
  44. package/dist/components/breadcrumbs/breadcrumbs.js.map +1 -0
  45. package/dist/components/breadcrumbs/breadcrumbs.styles.d.ts +1 -0
  46. package/dist/components/breadcrumbs/breadcrumbs.styles.js +225 -0
  47. package/dist/components/breadcrumbs/breadcrumbs.styles.js.map +1 -0
  48. package/dist/components/button/button.d.ts +280 -0
  49. package/dist/components/button/button.js +530 -0
  50. package/dist/components/button/button.js.map +1 -0
  51. package/dist/components/button/button.styles.d.ts +20 -0
  52. package/dist/components/button/button.styles.js +328 -0
  53. package/dist/components/button/button.styles.js.map +1 -0
  54. package/dist/components/button-group/button-group.d.ts +124 -0
  55. package/dist/components/button-group/button-group.js +287 -0
  56. package/dist/components/button-group/button-group.js.map +1 -0
  57. package/dist/components/button-group/button-group.styles.d.ts +1 -0
  58. package/dist/components/button-group/button-group.styles.js +220 -0
  59. package/dist/components/button-group/button-group.styles.js.map +1 -0
  60. package/dist/components/button-with-menu/button-with-menu.d.ts +224 -0
  61. package/dist/components/button-with-menu/button-with-menu.js +635 -0
  62. package/dist/components/button-with-menu/button-with-menu.js.map +1 -0
  63. package/dist/components/button-with-menu/button-with-menu.styles.d.ts +15 -0
  64. package/dist/components/button-with-menu/button-with-menu.styles.js +418 -0
  65. package/dist/components/button-with-menu/button-with-menu.styles.js.map +1 -0
  66. package/dist/components/calendar/calendar.d.ts +380 -0
  67. package/dist/components/calendar/calendar.js +1619 -0
  68. package/dist/components/calendar/calendar.js.map +1 -0
  69. package/dist/components/calendar/calendar.styles.d.ts +11 -0
  70. package/dist/components/calendar/calendar.styles.js +412 -0
  71. package/dist/components/calendar/calendar.styles.js.map +1 -0
  72. package/dist/components/callout/callout.d.ts +157 -0
  73. package/dist/components/callout/callout.js +436 -0
  74. package/dist/components/callout/callout.js.map +1 -0
  75. package/dist/components/callout/callout.styles.d.ts +13 -0
  76. package/dist/components/callout/callout.styles.js +383 -0
  77. package/dist/components/callout/callout.styles.js.map +1 -0
  78. package/dist/components/card/card.d.ts +108 -0
  79. package/dist/components/card/card.js +235 -0
  80. package/dist/components/card/card.js.map +1 -0
  81. package/dist/components/card/card.styles.d.ts +9 -0
  82. package/dist/components/card/card.styles.js +170 -0
  83. package/dist/components/card/card.styles.js.map +1 -0
  84. package/dist/components/carousel/carousel-geometry.d.ts +178 -0
  85. package/dist/components/carousel/carousel-geometry.js +356 -0
  86. package/dist/components/carousel/carousel-geometry.js.map +1 -0
  87. package/dist/components/carousel/carousel.d.ts +401 -0
  88. package/dist/components/carousel/carousel.js +1352 -0
  89. package/dist/components/carousel/carousel.js.map +1 -0
  90. package/dist/components/carousel/carousel.styles.d.ts +4 -0
  91. package/dist/components/carousel/carousel.styles.js +475 -0
  92. package/dist/components/carousel/carousel.styles.js.map +1 -0
  93. package/dist/components/chat-composer/chat-composer.d.ts +482 -0
  94. package/dist/components/chat-composer/chat-composer.js +1374 -0
  95. package/dist/components/chat-composer/chat-composer.js.map +1 -0
  96. package/dist/components/chat-composer/chat-composer.styles.d.ts +9 -0
  97. package/dist/components/chat-composer/chat-composer.styles.js +308 -0
  98. package/dist/components/chat-composer/chat-composer.styles.js.map +1 -0
  99. package/dist/components/checkbox/checkbox.d.ts +135 -0
  100. package/dist/components/checkbox/checkbox.js +296 -0
  101. package/dist/components/checkbox/checkbox.js.map +1 -0
  102. package/dist/components/checkbox/checkbox.styles.d.ts +13 -0
  103. package/dist/components/checkbox/checkbox.styles.js +226 -0
  104. package/dist/components/checkbox/checkbox.styles.js.map +1 -0
  105. package/dist/components/checkbox-group/checkbox-group.d.ts +199 -0
  106. package/dist/components/checkbox-group/checkbox-group.js +500 -0
  107. package/dist/components/checkbox-group/checkbox-group.js.map +1 -0
  108. package/dist/components/chip/chip.d.ts +176 -0
  109. package/dist/components/chip/chip.js +376 -0
  110. package/dist/components/chip/chip.js.map +1 -0
  111. package/dist/components/chip/chip.styles.d.ts +10 -0
  112. package/dist/components/chip/chip.styles.js +465 -0
  113. package/dist/components/chip/chip.styles.js.map +1 -0
  114. package/dist/components/chip-field/chip-field.d.ts +315 -0
  115. package/dist/components/chip-field/chip-field.js +887 -0
  116. package/dist/components/chip-field/chip-field.js.map +1 -0
  117. package/dist/components/code-block/code-block.before.d.ts +2 -0
  118. package/dist/components/code-block/code-block.before.js +193 -0
  119. package/dist/components/code-block/code-block.before.js.map +1 -0
  120. package/dist/components/code-block/code-block.d.ts +268 -0
  121. package/dist/components/code-block/code-block.js +1009 -0
  122. package/dist/components/code-block/code-block.js.map +1 -0
  123. package/dist/components/code-block/code-block.light.d.ts +50 -0
  124. package/dist/components/code-block/code-block.light.js +287 -0
  125. package/dist/components/code-block/code-block.light.js.map +1 -0
  126. package/dist/components/code-block/code-block.lines.d.ts +49 -0
  127. package/dist/components/code-block/code-block.lines.js +75 -0
  128. package/dist/components/code-block/code-block.lines.js.map +1 -0
  129. package/dist/components/code-block/code-block.styles.d.ts +8 -0
  130. package/dist/components/code-block/code-block.styles.js +212 -0
  131. package/dist/components/code-block/code-block.styles.js.map +1 -0
  132. package/dist/components/color-field/color-field.d.ts +120 -0
  133. package/dist/components/color-field/color-field.js +182 -0
  134. package/dist/components/color-field/color-field.js.map +1 -0
  135. package/dist/components/color-input/color-input.d.ts +302 -0
  136. package/dist/components/color-input/color-input.js +748 -0
  137. package/dist/components/color-input/color-input.js.map +1 -0
  138. package/dist/components/color-input/color-input.styles.d.ts +22 -0
  139. package/dist/components/color-input/color-input.styles.js +373 -0
  140. package/dist/components/color-input/color-input.styles.js.map +1 -0
  141. package/dist/components/color-input/color-text.d.ts +48 -0
  142. package/dist/components/color-input/color-text.js +77 -0
  143. package/dist/components/color-input/color-text.js.map +1 -0
  144. package/dist/components/combobox/combobox.d.ts +387 -0
  145. package/dist/components/combobox/combobox.js +1108 -0
  146. package/dist/components/combobox/combobox.js.map +1 -0
  147. package/dist/components/combobox/combobox.styles.d.ts +26 -0
  148. package/dist/components/combobox/combobox.styles.js +497 -0
  149. package/dist/components/combobox/combobox.styles.js.map +1 -0
  150. package/dist/components/combobox-field/combobox-field.d.ts +159 -0
  151. package/dist/components/combobox-field/combobox-field.js +280 -0
  152. package/dist/components/combobox-field/combobox-field.js.map +1 -0
  153. package/dist/components/copy-button/copy-button.d.ts +112 -0
  154. package/dist/components/copy-button/copy-button.js +237 -0
  155. package/dist/components/copy-button/copy-button.js.map +1 -0
  156. package/dist/components/copy-button/copy-button.styles.d.ts +1 -0
  157. package/dist/components/copy-button/copy-button.styles.js +62 -0
  158. package/dist/components/copy-button/copy-button.styles.js.map +1 -0
  159. package/dist/components/date-time-picker/date-time-picker.d.ts +603 -0
  160. package/dist/components/date-time-picker/date-time-picker.js +2537 -0
  161. package/dist/components/date-time-picker/date-time-picker.js.map +1 -0
  162. package/dist/components/date-time-picker/date-time-picker.styles.d.ts +1 -0
  163. package/dist/components/date-time-picker/date-time-picker.styles.js +842 -0
  164. package/dist/components/date-time-picker/date-time-picker.styles.js.map +1 -0
  165. package/dist/components/description-list/description-list.d.ts +133 -0
  166. package/dist/components/description-list/description-list.js +395 -0
  167. package/dist/components/description-list/description-list.js.map +1 -0
  168. package/dist/components/dialog/dialog.d.ts +140 -0
  169. package/dist/components/dialog/dialog.js +440 -0
  170. package/dist/components/dialog/dialog.js.map +1 -0
  171. package/dist/components/dialog/dialog.styles.d.ts +1 -0
  172. package/dist/components/dialog/dialog.styles.js +306 -0
  173. package/dist/components/dialog/dialog.styles.js.map +1 -0
  174. package/dist/components/divider/divider.d.ts +112 -0
  175. package/dist/components/divider/divider.js +331 -0
  176. package/dist/components/divider/divider.js.map +1 -0
  177. package/dist/components/divider/divider.styles.d.ts +6 -0
  178. package/dist/components/divider/divider.styles.js +183 -0
  179. package/dist/components/divider/divider.styles.js.map +1 -0
  180. package/dist/components/embedded-text-input/embedded-text-input.d.ts +246 -0
  181. package/dist/components/embedded-text-input/embedded-text-input.js +673 -0
  182. package/dist/components/embedded-text-input/embedded-text-input.js.map +1 -0
  183. package/dist/components/embedded-text-input/embedded-text-input.styles.d.ts +1 -0
  184. package/dist/components/embedded-text-input/embedded-text-input.styles.js +204 -0
  185. package/dist/components/embedded-text-input/embedded-text-input.styles.js.map +1 -0
  186. package/dist/components/empty-state/empty-state.d.ts +132 -0
  187. package/dist/components/empty-state/empty-state.js +333 -0
  188. package/dist/components/empty-state/empty-state.js.map +1 -0
  189. package/dist/components/empty-state/empty-state.styles.d.ts +11 -0
  190. package/dist/components/empty-state/empty-state.styles.js +218 -0
  191. package/dist/components/empty-state/empty-state.styles.js.map +1 -0
  192. package/dist/components/fab-menu/fab-menu.d.ts +240 -0
  193. package/dist/components/fab-menu/fab-menu.js +605 -0
  194. package/dist/components/fab-menu/fab-menu.js.map +1 -0
  195. package/dist/components/fab-menu/fab-menu.styles.d.ts +21 -0
  196. package/dist/components/fab-menu/fab-menu.styles.js +427 -0
  197. package/dist/components/fab-menu/fab-menu.styles.js.map +1 -0
  198. package/dist/components/field/field.d.ts +165 -0
  199. package/dist/components/field/field.js +399 -0
  200. package/dist/components/field/field.js.map +1 -0
  201. package/dist/components/field/field.styles.d.ts +2 -0
  202. package/dist/components/field/field.styles.js +177 -0
  203. package/dist/components/field/field.styles.js.map +1 -0
  204. package/dist/components/field-group/field-group.d.ts +122 -0
  205. package/dist/components/field-group/field-group.js +246 -0
  206. package/dist/components/field-group/field-group.js.map +1 -0
  207. package/dist/components/field-group/field-group.styles.d.ts +7 -0
  208. package/dist/components/field-group/field-group.styles.js +28 -0
  209. package/dist/components/field-group/field-group.styles.js.map +1 -0
  210. package/dist/components/figure/figure.d.ts +152 -0
  211. package/dist/components/figure/figure.js +435 -0
  212. package/dist/components/figure/figure.js.map +1 -0
  213. package/dist/components/file-item/file-item.d.ts +232 -0
  214. package/dist/components/file-item/file-item.js +665 -0
  215. package/dist/components/file-item/file-item.js.map +1 -0
  216. package/dist/components/file-item/file-item.styles.d.ts +2 -0
  217. package/dist/components/file-item/file-item.styles.js +582 -0
  218. package/dist/components/file-item/file-item.styles.js.map +1 -0
  219. package/dist/components/file-picker/file-picker.d.ts +221 -0
  220. package/dist/components/file-picker/file-picker.js +588 -0
  221. package/dist/components/file-picker/file-picker.js.map +1 -0
  222. package/dist/components/file-picker/file-picker.styles.d.ts +2 -0
  223. package/dist/components/file-picker/file-picker.styles.js +303 -0
  224. package/dist/components/file-picker/file-picker.styles.js.map +1 -0
  225. package/dist/components/file-upload/file-upload.d.ts +353 -0
  226. package/dist/components/file-upload/file-upload.js +939 -0
  227. package/dist/components/file-upload/file-upload.js.map +1 -0
  228. package/dist/components/file-upload/file-upload.styles.d.ts +1 -0
  229. package/dist/components/file-upload/file-upload.styles.js +91 -0
  230. package/dist/components/file-upload/file-upload.styles.js.map +1 -0
  231. package/dist/components/image-preview/image-preview.d.ts +336 -0
  232. package/dist/components/image-preview/image-preview.js +1510 -0
  233. package/dist/components/image-preview/image-preview.js.map +1 -0
  234. package/dist/components/image-preview/image-preview.styles.d.ts +1 -0
  235. package/dist/components/image-preview/image-preview.styles.js +418 -0
  236. package/dist/components/image-preview/image-preview.styles.js.map +1 -0
  237. package/dist/components/keyboard-shortcut/keyboard-shortcut.d.ts +94 -0
  238. package/dist/components/keyboard-shortcut/keyboard-shortcut.js +285 -0
  239. package/dist/components/keyboard-shortcut/keyboard-shortcut.js.map +1 -0
  240. package/dist/components/keyboard-shortcut/keyboard-shortcut.styles.d.ts +11 -0
  241. package/dist/components/keyboard-shortcut/keyboard-shortcut.styles.js +155 -0
  242. package/dist/components/keyboard-shortcut/keyboard-shortcut.styles.js.map +1 -0
  243. package/dist/components/link-card/link-card.d.ts +156 -0
  244. package/dist/components/link-card/link-card.js +713 -0
  245. package/dist/components/link-card/link-card.js.map +1 -0
  246. package/dist/components/list/list.d.ts +430 -0
  247. package/dist/components/list/list.js +1230 -0
  248. package/dist/components/list/list.js.map +1 -0
  249. package/dist/components/list/list.styles.d.ts +3 -0
  250. package/dist/components/list/list.styles.js +334 -0
  251. package/dist/components/list/list.styles.js.map +1 -0
  252. package/dist/components/loading-indicator/loading-indicator.d.ts +83 -0
  253. package/dist/components/loading-indicator/loading-indicator.js +195 -0
  254. package/dist/components/loading-indicator/loading-indicator.js.map +1 -0
  255. package/dist/components/loading-indicator/loading-indicator.styles.d.ts +6 -0
  256. package/dist/components/loading-indicator/loading-indicator.styles.js +124 -0
  257. package/dist/components/loading-indicator/loading-indicator.styles.js.map +1 -0
  258. package/dist/components/main-action-button/main-action-button.d.ts +95 -0
  259. package/dist/components/main-action-button/main-action-button.js +202 -0
  260. package/dist/components/main-action-button/main-action-button.js.map +1 -0
  261. package/dist/components/main-action-button/main-action-button.styles.d.ts +10 -0
  262. package/dist/components/main-action-button/main-action-button.styles.js +285 -0
  263. package/dist/components/main-action-button/main-action-button.styles.js.map +1 -0
  264. package/dist/components/menu/menu.d.ts +813 -0
  265. package/dist/components/menu/menu.js +2061 -0
  266. package/dist/components/menu/menu.js.map +1 -0
  267. package/dist/components/menu/menu.styles.d.ts +18 -0
  268. package/dist/components/menu/menu.styles.js +587 -0
  269. package/dist/components/menu/menu.styles.js.map +1 -0
  270. package/dist/components/menubar/menubar.d.ts +477 -0
  271. package/dist/components/menubar/menubar.js +1677 -0
  272. package/dist/components/menubar/menubar.js.map +1 -0
  273. package/dist/components/menubar/menubar.styles.d.ts +43 -0
  274. package/dist/components/menubar/menubar.styles.js +379 -0
  275. package/dist/components/menubar/menubar.styles.js.map +1 -0
  276. package/dist/components/navigation-bar/navigation-bar.d.ts +239 -0
  277. package/dist/components/navigation-bar/navigation-bar.js +544 -0
  278. package/dist/components/navigation-bar/navigation-bar.js.map +1 -0
  279. package/dist/components/navigation-bar/navigation-bar.styles.d.ts +21 -0
  280. package/dist/components/navigation-bar/navigation-bar.styles.js +320 -0
  281. package/dist/components/navigation-bar/navigation-bar.styles.js.map +1 -0
  282. package/dist/components/navigation-drawer/navigation-drawer.d.ts +627 -0
  283. package/dist/components/navigation-drawer/navigation-drawer.js +1917 -0
  284. package/dist/components/navigation-drawer/navigation-drawer.js.map +1 -0
  285. package/dist/components/navigation-drawer/navigation-drawer.styles.d.ts +40 -0
  286. package/dist/components/navigation-drawer/navigation-drawer.styles.js +934 -0
  287. package/dist/components/navigation-drawer/navigation-drawer.styles.js.map +1 -0
  288. package/dist/components/number-field/number-field.d.ts +147 -0
  289. package/dist/components/number-field/number-field.js +252 -0
  290. package/dist/components/number-field/number-field.js.map +1 -0
  291. package/dist/components/number-input/number-input.d.ts +347 -0
  292. package/dist/components/number-input/number-input.js +929 -0
  293. package/dist/components/number-input/number-input.js.map +1 -0
  294. package/dist/components/number-input/number-input.styles.d.ts +22 -0
  295. package/dist/components/number-input/number-input.styles.js +395 -0
  296. package/dist/components/number-input/number-input.styles.js.map +1 -0
  297. package/dist/components/number-input/number-text.d.ts +74 -0
  298. package/dist/components/number-input/number-text.js +230 -0
  299. package/dist/components/number-input/number-text.js.map +1 -0
  300. package/dist/components/one-time-code-field/one-time-code-field.d.ts +94 -0
  301. package/dist/components/one-time-code-field/one-time-code-field.js +135 -0
  302. package/dist/components/one-time-code-field/one-time-code-field.js.map +1 -0
  303. package/dist/components/one-time-code-input/code-text.d.ts +51 -0
  304. package/dist/components/one-time-code-input/code-text.js +145 -0
  305. package/dist/components/one-time-code-input/code-text.js.map +1 -0
  306. package/dist/components/one-time-code-input/one-time-code-input.d.ts +219 -0
  307. package/dist/components/one-time-code-input/one-time-code-input.js +710 -0
  308. package/dist/components/one-time-code-input/one-time-code-input.js.map +1 -0
  309. package/dist/components/one-time-code-input/one-time-code-input.styles.d.ts +8 -0
  310. package/dist/components/one-time-code-input/one-time-code-input.styles.js +323 -0
  311. package/dist/components/one-time-code-input/one-time-code-input.styles.js.map +1 -0
  312. package/dist/components/option/option.d.ts +51 -0
  313. package/dist/components/option/option.js +75 -0
  314. package/dist/components/option/option.js.map +1 -0
  315. package/dist/components/page-header/page-header.d.ts +97 -0
  316. package/dist/components/page-header/page-header.js +258 -0
  317. package/dist/components/page-header/page-header.js.map +1 -0
  318. package/dist/components/popover/popover.d.ts +217 -0
  319. package/dist/components/popover/popover.js +616 -0
  320. package/dist/components/popover/popover.js.map +1 -0
  321. package/dist/components/popover/popover.styles.d.ts +8 -0
  322. package/dist/components/popover/popover.styles.js +299 -0
  323. package/dist/components/popover/popover.styles.js.map +1 -0
  324. package/dist/components/progress-indicator/progress-indicator.d.ts +76 -0
  325. package/dist/components/progress-indicator/progress-indicator.js +165 -0
  326. package/dist/components/progress-indicator/progress-indicator.js.map +1 -0
  327. package/dist/components/progress-indicator/progress-indicator.styles.d.ts +7 -0
  328. package/dist/components/progress-indicator/progress-indicator.styles.js +271 -0
  329. package/dist/components/progress-indicator/progress-indicator.styles.js.map +1 -0
  330. package/dist/components/radio-button/radio-button.d.ts +149 -0
  331. package/dist/components/radio-button/radio-button.js +370 -0
  332. package/dist/components/radio-button/radio-button.js.map +1 -0
  333. package/dist/components/radio-button/radio-button.styles.d.ts +8 -0
  334. package/dist/components/radio-button/radio-button.styles.js +190 -0
  335. package/dist/components/radio-button/radio-button.styles.js.map +1 -0
  336. package/dist/components/radio-group/radio-group.d.ts +188 -0
  337. package/dist/components/radio-group/radio-group.js +380 -0
  338. package/dist/components/radio-group/radio-group.js.map +1 -0
  339. package/dist/components/search/search.d.ts +569 -0
  340. package/dist/components/search/search.js +1801 -0
  341. package/dist/components/search/search.js.map +1 -0
  342. package/dist/components/search/search.styles.d.ts +15 -0
  343. package/dist/components/search/search.styles.js +967 -0
  344. package/dist/components/search/search.styles.js.map +1 -0
  345. package/dist/components/segmented-button/segmented-button.d.ts +183 -0
  346. package/dist/components/segmented-button/segmented-button.js +483 -0
  347. package/dist/components/segmented-button/segmented-button.js.map +1 -0
  348. package/dist/components/segmented-button/segmented-button.styles.d.ts +19 -0
  349. package/dist/components/segmented-button/segmented-button.styles.js +400 -0
  350. package/dist/components/segmented-button/segmented-button.styles.js.map +1 -0
  351. package/dist/components/select/select.d.ts +259 -0
  352. package/dist/components/select/select.js +702 -0
  353. package/dist/components/select/select.js.map +1 -0
  354. package/dist/components/select/select.styles.d.ts +27 -0
  355. package/dist/components/select/select.styles.js +359 -0
  356. package/dist/components/select/select.styles.js.map +1 -0
  357. package/dist/components/select-field/select-field.d.ts +141 -0
  358. package/dist/components/select-field/select-field.js +234 -0
  359. package/dist/components/select-field/select-field.js.map +1 -0
  360. package/dist/components/side-sheet/side-sheet.d.ts +190 -0
  361. package/dist/components/side-sheet/side-sheet.js +592 -0
  362. package/dist/components/side-sheet/side-sheet.js.map +1 -0
  363. package/dist/components/side-sheet/side-sheet.styles.d.ts +9 -0
  364. package/dist/components/side-sheet/side-sheet.styles.js +352 -0
  365. package/dist/components/side-sheet/side-sheet.styles.js.map +1 -0
  366. package/dist/components/skeleton/skeleton.d.ts +157 -0
  367. package/dist/components/skeleton/skeleton.js +550 -0
  368. package/dist/components/skeleton/skeleton.js.map +1 -0
  369. package/dist/components/slider/slider.d.ts +235 -0
  370. package/dist/components/slider/slider.js +792 -0
  371. package/dist/components/slider/slider.js.map +1 -0
  372. package/dist/components/slider/slider.styles.d.ts +6 -0
  373. package/dist/components/slider/slider.styles.js +492 -0
  374. package/dist/components/slider/slider.styles.js.map +1 -0
  375. package/dist/components/slider-field/slider-field.d.ts +150 -0
  376. package/dist/components/slider-field/slider-field.js +269 -0
  377. package/dist/components/slider-field/slider-field.js.map +1 -0
  378. package/dist/components/snackbar/snackbar.d.ts +237 -0
  379. package/dist/components/snackbar/snackbar.js +607 -0
  380. package/dist/components/snackbar/snackbar.js.map +1 -0
  381. package/dist/components/snackbar/snackbar.styles.d.ts +10 -0
  382. package/dist/components/snackbar/snackbar.styles.js +510 -0
  383. package/dist/components/snackbar/snackbar.styles.js.map +1 -0
  384. package/dist/components/switch/switch.d.ts +161 -0
  385. package/dist/components/switch/switch.js +470 -0
  386. package/dist/components/switch/switch.js.map +1 -0
  387. package/dist/components/switch/switch.styles.d.ts +3 -0
  388. package/dist/components/switch/switch.styles.js +440 -0
  389. package/dist/components/switch/switch.styles.js.map +1 -0
  390. package/dist/components/tab-view/tab-view.d.ts +303 -0
  391. package/dist/components/tab-view/tab-view.js +917 -0
  392. package/dist/components/tab-view/tab-view.js.map +1 -0
  393. package/dist/components/tab-view/tab-view.styles.d.ts +19 -0
  394. package/dist/components/tab-view/tab-view.styles.js +85 -0
  395. package/dist/components/tab-view/tab-view.styles.js.map +1 -0
  396. package/dist/components/table/table.d.ts +386 -0
  397. package/dist/components/table/table.js +1320 -0
  398. package/dist/components/table/table.js.map +1 -0
  399. package/dist/components/table-of-contents/table-of-contents.d.ts +227 -0
  400. package/dist/components/table-of-contents/table-of-contents.js +963 -0
  401. package/dist/components/table-of-contents/table-of-contents.js.map +1 -0
  402. package/dist/components/table-of-contents/table-of-contents.styles.d.ts +1 -0
  403. package/dist/components/table-of-contents/table-of-contents.styles.js +243 -0
  404. package/dist/components/table-of-contents/table-of-contents.styles.js.map +1 -0
  405. package/dist/components/tabs/tabs.d.ts +800 -0
  406. package/dist/components/tabs/tabs.js +2183 -0
  407. package/dist/components/tabs/tabs.js.map +1 -0
  408. package/dist/components/tabs/tabs.styles.d.ts +47 -0
  409. package/dist/components/tabs/tabs.styles.js +595 -0
  410. package/dist/components/tabs/tabs.styles.js.map +1 -0
  411. package/dist/components/tag/tag.d.ts +77 -0
  412. package/dist/components/tag/tag.js +143 -0
  413. package/dist/components/tag/tag.js.map +1 -0
  414. package/dist/components/tag/tag.styles.d.ts +13 -0
  415. package/dist/components/tag/tag.styles.js +215 -0
  416. package/dist/components/tag/tag.styles.js.map +1 -0
  417. package/dist/components/tag-group/tag-group.d.ts +110 -0
  418. package/dist/components/tag-group/tag-group.js +298 -0
  419. package/dist/components/tag-group/tag-group.js.map +1 -0
  420. package/dist/components/tag-group/tag-group.styles.d.ts +8 -0
  421. package/dist/components/tag-group/tag-group.styles.js +66 -0
  422. package/dist/components/tag-group/tag-group.styles.js.map +1 -0
  423. package/dist/components/text-field/text-field.d.ts +159 -0
  424. package/dist/components/text-field/text-field.js +272 -0
  425. package/dist/components/text-field/text-field.js.map +1 -0
  426. package/dist/components/text-input/text-input-segments.d.ts +93 -0
  427. package/dist/components/text-input/text-input-segments.js +233 -0
  428. package/dist/components/text-input/text-input-segments.js.map +1 -0
  429. package/dist/components/text-input/text-input.d.ts +683 -0
  430. package/dist/components/text-input/text-input.js +2120 -0
  431. package/dist/components/text-input/text-input.js.map +1 -0
  432. package/dist/components/text-input/text-input.styles.d.ts +27 -0
  433. package/dist/components/text-input/text-input.styles.js +1071 -0
  434. package/dist/components/text-input/text-input.styles.js.map +1 -0
  435. package/dist/components/toolbar/toolbar.d.ts +123 -0
  436. package/dist/components/toolbar/toolbar.js +336 -0
  437. package/dist/components/toolbar/toolbar.js.map +1 -0
  438. package/dist/components/toolbar/toolbar.styles.d.ts +10 -0
  439. package/dist/components/toolbar/toolbar.styles.js +156 -0
  440. package/dist/components/toolbar/toolbar.styles.js.map +1 -0
  441. package/dist/components/tooltip/tooltip-placement.d.ts +22 -0
  442. package/dist/components/tooltip/tooltip-placement.js +15 -0
  443. package/dist/components/tooltip/tooltip-placement.js.map +1 -0
  444. package/dist/components/tooltip/tooltip.d.ts +267 -0
  445. package/dist/components/tooltip/tooltip.js +902 -0
  446. package/dist/components/tooltip/tooltip.js.map +1 -0
  447. package/dist/components/tooltip/tooltip.styles.d.ts +7 -0
  448. package/dist/components/tooltip/tooltip.styles.js +240 -0
  449. package/dist/components/tooltip/tooltip.styles.js.map +1 -0
  450. package/dist/components/tree-view/tree-view.d.ts +264 -0
  451. package/dist/components/tree-view/tree-view.js +1228 -0
  452. package/dist/components/tree-view/tree-view.js.map +1 -0
  453. package/dist/description-list.css +337 -0
  454. package/dist/empty-state.css +70 -0
  455. package/dist/figure.css +381 -0
  456. package/dist/generated/icon-sets.d.ts +9 -0
  457. package/dist/generated/icon-sets.js +18 -0
  458. package/dist/generated/icon-sets.js.map +1 -0
  459. package/dist/generated/words.d.ts +161 -0
  460. package/dist/generated/words.js +91 -0
  461. package/dist/generated/words.js.map +1 -0
  462. package/dist/highlight/grammars/css.d.ts +3 -0
  463. package/dist/highlight/grammars/css.js +56 -0
  464. package/dist/highlight/grammars/css.js.map +1 -0
  465. package/dist/highlight/grammars/dart.d.ts +3 -0
  466. package/dist/highlight/grammars/dart.js +53 -0
  467. package/dist/highlight/grammars/dart.js.map +1 -0
  468. package/dist/highlight/grammars/javascript.d.ts +4 -0
  469. package/dist/highlight/grammars/javascript.js +119 -0
  470. package/dist/highlight/grammars/javascript.js.map +1 -0
  471. package/dist/highlight/grammars/json.d.ts +3 -0
  472. package/dist/highlight/grammars/json.js +19 -0
  473. package/dist/highlight/grammars/json.js.map +1 -0
  474. package/dist/highlight/grammars/kotlin.d.ts +3 -0
  475. package/dist/highlight/grammars/kotlin.js +46 -0
  476. package/dist/highlight/grammars/kotlin.js.map +1 -0
  477. package/dist/highlight/grammars/markup.d.ts +3 -0
  478. package/dist/highlight/grammars/markup.js +45 -0
  479. package/dist/highlight/grammars/markup.js.map +1 -0
  480. package/dist/highlight/grammars/shared.d.ts +25 -0
  481. package/dist/highlight/grammars/shared.js +37 -0
  482. package/dist/highlight/grammars/shared.js.map +1 -0
  483. package/dist/highlight/grammars/shell.d.ts +3 -0
  484. package/dist/highlight/grammars/shell.js +48 -0
  485. package/dist/highlight/grammars/shell.js.map +1 -0
  486. package/dist/highlight/grammars/swift.d.ts +3 -0
  487. package/dist/highlight/grammars/swift.js +46 -0
  488. package/dist/highlight/grammars/swift.js.map +1 -0
  489. package/dist/highlight/grammars/typescript.d.ts +2 -0
  490. package/dist/highlight/grammars/typescript.js +5 -0
  491. package/dist/highlight/grammars/typescript.js.map +1 -0
  492. package/dist/highlight/index.d.ts +104 -0
  493. package/dist/highlight/index.js +331 -0
  494. package/dist/highlight/index.js.map +1 -0
  495. package/dist/icons.css +107 -0
  496. package/dist/icons.d.ts +2 -0
  497. package/dist/icons.js +10 -0
  498. package/dist/icons.js.map +1 -0
  499. package/dist/index.d.ts +85 -0
  500. package/dist/index.js +100 -0
  501. package/dist/index.js.map +1 -0
  502. package/dist/link-card.css +678 -0
  503. package/dist/link.css +728 -0
  504. package/dist/link.d.ts +21 -0
  505. package/dist/link.js +594 -0
  506. package/dist/link.js.map +1 -0
  507. package/dist/links/index.d.ts +136 -0
  508. package/dist/links/index.js +404 -0
  509. package/dist/links/index.js.map +1 -0
  510. package/dist/links/node/address.js +154 -0
  511. package/dist/links/node/cli.js +102 -0
  512. package/dist/links/node/fetcher.js +267 -0
  513. package/dist/links/node/head.js +278 -0
  514. package/dist/links/node/index.d.ts +164 -0
  515. package/dist/links/node/index.js +26 -0
  516. package/dist/links/node/links.js +275 -0
  517. package/dist/links/node/lock.js +86 -0
  518. package/dist/links/node/mark.js +71 -0
  519. package/dist/links/node/options.js +120 -0
  520. package/dist/links/node/pictures.js +265 -0
  521. package/dist/links/node/refresh.js +28 -0
  522. package/dist/menu.css +97 -0
  523. package/dist/menubar.css +69 -0
  524. package/dist/page-header.css +324 -0
  525. package/dist/pagination.css +410 -0
  526. package/dist/pagination.d.ts +6 -0
  527. package/dist/pagination.js +256 -0
  528. package/dist/pagination.js.map +1 -0
  529. package/dist/primitives/actions.d.ts +75 -0
  530. package/dist/primitives/actions.js +142 -0
  531. package/dist/primitives/actions.js.map +1 -0
  532. package/dist/primitives/after-click.d.ts +8 -0
  533. package/dist/primitives/after-click.js +21 -0
  534. package/dist/primitives/after-click.js.map +1 -0
  535. package/dist/primitives/anchored.d.ts +134 -0
  536. package/dist/primitives/anchored.js +425 -0
  537. package/dist/primitives/anchored.js.map +1 -0
  538. package/dist/primitives/arc.d.ts +13 -0
  539. package/dist/primitives/arc.js +49 -0
  540. package/dist/primitives/arc.js.map +1 -0
  541. package/dist/primitives/arrow.d.ts +47 -0
  542. package/dist/primitives/arrow.js +159 -0
  543. package/dist/primitives/arrow.js.map +1 -0
  544. package/dist/primitives/auto-height.d.ts +56 -0
  545. package/dist/primitives/auto-height.js +150 -0
  546. package/dist/primitives/auto-height.js.map +1 -0
  547. package/dist/primitives/autofocus.d.ts +11 -0
  548. package/dist/primitives/autofocus.js +26 -0
  549. package/dist/primitives/autofocus.js.map +1 -0
  550. package/dist/primitives/availability.d.ts +32 -0
  551. package/dist/primitives/availability.js +122 -0
  552. package/dist/primitives/availability.js.map +1 -0
  553. package/dist/primitives/axes.d.ts +45 -0
  554. package/dist/primitives/axes.js +72 -0
  555. package/dist/primitives/axes.js.map +1 -0
  556. package/dist/primitives/behavior.d.ts +14 -0
  557. package/dist/primitives/behavior.js +19 -0
  558. package/dist/primitives/behavior.js.map +1 -0
  559. package/dist/primitives/calendar-date.d.ts +79 -0
  560. package/dist/primitives/calendar-date.js +135 -0
  561. package/dist/primitives/calendar-date.js.map +1 -0
  562. package/dist/primitives/composed.d.ts +144 -0
  563. package/dist/primitives/composed.js +303 -0
  564. package/dist/primitives/composed.js.map +1 -0
  565. package/dist/primitives/default-button.d.ts +49 -0
  566. package/dist/primitives/default-button.js +270 -0
  567. package/dist/primitives/default-button.js.map +1 -0
  568. package/dist/primitives/description.d.ts +18 -0
  569. package/dist/primitives/description.js +18 -0
  570. package/dist/primitives/description.js.map +1 -0
  571. package/dist/primitives/destination.d.ts +259 -0
  572. package/dist/primitives/destination.js +651 -0
  573. package/dist/primitives/destination.js.map +1 -0
  574. package/dist/primitives/direction.d.ts +23 -0
  575. package/dist/primitives/direction.js +90 -0
  576. package/dist/primitives/direction.js.map +1 -0
  577. package/dist/primitives/disabled-while-focused.d.ts +46 -0
  578. package/dist/primitives/disabled-while-focused.js +126 -0
  579. package/dist/primitives/disabled-while-focused.js.map +1 -0
  580. package/dist/primitives/disclosure.d.ts +9 -0
  581. package/dist/primitives/disclosure.js +15 -0
  582. package/dist/primitives/disclosure.js.map +1 -0
  583. package/dist/primitives/dismiss.d.ts +88 -0
  584. package/dist/primitives/dismiss.js +232 -0
  585. package/dist/primitives/dismiss.js.map +1 -0
  586. package/dist/primitives/field-frame.d.ts +166 -0
  587. package/dist/primitives/field-frame.js +358 -0
  588. package/dist/primitives/field-frame.js.map +1 -0
  589. package/dist/primitives/field-group-frame.d.ts +59 -0
  590. package/dist/primitives/field-group-frame.js +174 -0
  591. package/dist/primitives/field-group-frame.js.map +1 -0
  592. package/dist/primitives/field-trigger.d.ts +117 -0
  593. package/dist/primitives/field-trigger.js +387 -0
  594. package/dist/primitives/field-trigger.js.map +1 -0
  595. package/dist/primitives/field.d.ts +186 -0
  596. package/dist/primitives/field.js +349 -0
  597. package/dist/primitives/field.js.map +1 -0
  598. package/dist/primitives/file-format.d.ts +23 -0
  599. package/dist/primitives/file-format.js +185 -0
  600. package/dist/primitives/file-format.js.map +1 -0
  601. package/dist/primitives/file-item-holder.d.ts +45 -0
  602. package/dist/primitives/file-item-holder.js +39 -0
  603. package/dist/primitives/file-item-holder.js.map +1 -0
  604. package/dist/primitives/focus-order.d.ts +11 -0
  605. package/dist/primitives/focus-order.js +11 -0
  606. package/dist/primitives/focus-order.js.map +1 -0
  607. package/dist/primitives/focus-ring.d.ts +76 -0
  608. package/dist/primitives/focus-ring.js +230 -0
  609. package/dist/primitives/focus-ring.js.map +1 -0
  610. package/dist/primitives/follow.d.ts +65 -0
  611. package/dist/primitives/follow.js +283 -0
  612. package/dist/primitives/follow.js.map +1 -0
  613. package/dist/primitives/form-disabled.d.ts +20 -0
  614. package/dist/primitives/form-disabled.js +46 -0
  615. package/dist/primitives/form-disabled.js.map +1 -0
  616. package/dist/primitives/form-says.d.ts +33 -0
  617. package/dist/primitives/form-says.js +45 -0
  618. package/dist/primitives/form-says.js.map +1 -0
  619. package/dist/primitives/forward.d.ts +13 -0
  620. package/dist/primitives/forward.js +28 -0
  621. package/dist/primitives/forward.js.map +1 -0
  622. package/dist/primitives/glyph-mirror.d.ts +77 -0
  623. package/dist/primitives/glyph-mirror.js +211 -0
  624. package/dist/primitives/glyph-mirror.js.map +1 -0
  625. package/dist/primitives/glyph-pending.d.ts +17 -0
  626. package/dist/primitives/glyph-pending.js +91 -0
  627. package/dist/primitives/glyph-pending.js.map +1 -0
  628. package/dist/primitives/glyph.d.ts +53 -0
  629. package/dist/primitives/glyph.js +161 -0
  630. package/dist/primitives/glyph.js.map +1 -0
  631. package/dist/primitives/group-item.d.ts +128 -0
  632. package/dist/primitives/group-item.js +334 -0
  633. package/dist/primitives/group-item.js.map +1 -0
  634. package/dist/primitives/hidden.d.ts +2 -0
  635. package/dist/primitives/hidden.js +23 -0
  636. package/dist/primitives/hidden.js.map +1 -0
  637. package/dist/primitives/host-aria.d.ts +8 -0
  638. package/dist/primitives/host-aria.js +18 -0
  639. package/dist/primitives/host-aria.js.map +1 -0
  640. package/dist/primitives/index.d.ts +59 -0
  641. package/dist/primitives/index.js +189 -0
  642. package/dist/primitives/index.js.map +1 -0
  643. package/dist/primitives/indicator-drag.d.ts +90 -0
  644. package/dist/primitives/indicator-drag.js +207 -0
  645. package/dist/primitives/indicator-drag.js.map +1 -0
  646. package/dist/primitives/interactive.d.ts +13 -0
  647. package/dist/primitives/interactive.js +67 -0
  648. package/dist/primitives/interactive.js.map +1 -0
  649. package/dist/primitives/item-row.d.ts +34 -0
  650. package/dist/primitives/item-row.js +76 -0
  651. package/dist/primitives/item-row.js.map +1 -0
  652. package/dist/primitives/item-update.d.ts +2 -0
  653. package/dist/primitives/item-update.js +12 -0
  654. package/dist/primitives/item-update.js.map +1 -0
  655. package/dist/primitives/kept-length.d.ts +34 -0
  656. package/dist/primitives/kept-length.js +154 -0
  657. package/dist/primitives/kept-length.js.map +1 -0
  658. package/dist/primitives/keyboard-convention.d.ts +30 -0
  659. package/dist/primitives/keyboard-convention.js +88 -0
  660. package/dist/primitives/keyboard-convention.js.map +1 -0
  661. package/dist/primitives/label-lines.d.ts +12 -0
  662. package/dist/primitives/label-lines.js +34 -0
  663. package/dist/primitives/label-lines.js.map +1 -0
  664. package/dist/primitives/layout-scale.d.ts +18 -0
  665. package/dist/primitives/layout-scale.js +35 -0
  666. package/dist/primitives/layout-scale.js.map +1 -0
  667. package/dist/primitives/link.d.ts +147 -0
  668. package/dist/primitives/link.js +204 -0
  669. package/dist/primitives/link.js.map +1 -0
  670. package/dist/primitives/locale-date.d.ts +132 -0
  671. package/dist/primitives/locale-date.js +508 -0
  672. package/dist/primitives/locale-date.js.map +1 -0
  673. package/dist/primitives/missing-value.d.ts +16 -0
  674. package/dist/primitives/missing-value.js +31 -0
  675. package/dist/primitives/missing-value.js.map +1 -0
  676. package/dist/primitives/modal.d.ts +38 -0
  677. package/dist/primitives/modal.js +175 -0
  678. package/dist/primitives/modal.js.map +1 -0
  679. package/dist/primitives/native-text.d.ts +51 -0
  680. package/dist/primitives/native-text.js +77 -0
  681. package/dist/primitives/native-text.js.map +1 -0
  682. package/dist/primitives/natural-height.d.ts +21 -0
  683. package/dist/primitives/natural-height.js +36 -0
  684. package/dist/primitives/natural-height.js.map +1 -0
  685. package/dist/primitives/option-list.d.ts +314 -0
  686. package/dist/primitives/option-list.js +1098 -0
  687. package/dist/primitives/option-list.js.map +1 -0
  688. package/dist/primitives/overlay-focus.d.ts +48 -0
  689. package/dist/primitives/overlay-focus.js +152 -0
  690. package/dist/primitives/overlay-focus.js.map +1 -0
  691. package/dist/primitives/placement.d.ts +131 -0
  692. package/dist/primitives/placement.js +144 -0
  693. package/dist/primitives/placement.js.map +1 -0
  694. package/dist/primitives/places.d.ts +44 -0
  695. package/dist/primitives/places.js +98 -0
  696. package/dist/primitives/places.js.map +1 -0
  697. package/dist/primitives/press.d.ts +90 -0
  698. package/dist/primitives/press.js +153 -0
  699. package/dist/primitives/press.js.map +1 -0
  700. package/dist/primitives/report.d.ts +17 -0
  701. package/dist/primitives/report.js +34 -0
  702. package/dist/primitives/report.js.map +1 -0
  703. package/dist/primitives/ripple.d.ts +40 -0
  704. package/dist/primitives/ripple.js +70 -0
  705. package/dist/primitives/ripple.js.map +1 -0
  706. package/dist/primitives/roving.d.ts +41 -0
  707. package/dist/primitives/roving.js +71 -0
  708. package/dist/primitives/roving.js.map +1 -0
  709. package/dist/primitives/selection.d.ts +134 -0
  710. package/dist/primitives/selection.js +287 -0
  711. package/dist/primitives/selection.js.map +1 -0
  712. package/dist/primitives/separation.d.ts +28 -0
  713. package/dist/primitives/separation.js +96 -0
  714. package/dist/primitives/separation.js.map +1 -0
  715. package/dist/primitives/shared-choice.d.ts +33 -0
  716. package/dist/primitives/shared-choice.js +110 -0
  717. package/dist/primitives/shared-choice.js.map +1 -0
  718. package/dist/primitives/sheet.d.ts +63 -0
  719. package/dist/primitives/sheet.js +139 -0
  720. package/dist/primitives/sheet.js.map +1 -0
  721. package/dist/primitives/sheets.d.ts +8 -0
  722. package/dist/primitives/sheets.js +96 -0
  723. package/dist/primitives/sheets.js.map +1 -0
  724. package/dist/primitives/states.d.ts +33 -0
  725. package/dist/primitives/states.js +30 -0
  726. package/dist/primitives/states.js.map +1 -0
  727. package/dist/primitives/system-watch.d.ts +9 -0
  728. package/dist/primitives/system-watch.js +29 -0
  729. package/dist/primitives/system-watch.js.map +1 -0
  730. package/dist/primitives/target.d.ts +21 -0
  731. package/dist/primitives/target.js +79 -0
  732. package/dist/primitives/target.js.map +1 -0
  733. package/dist/primitives/values.d.ts +6 -0
  734. package/dist/primitives/values.js +22 -0
  735. package/dist/primitives/values.js.map +1 -0
  736. package/dist/primitives/visibility.d.ts +12 -0
  737. package/dist/primitives/visibility.js +50 -0
  738. package/dist/primitives/visibility.js.map +1 -0
  739. package/dist/primitives/words.d.ts +81 -0
  740. package/dist/primitives/words.js +236 -0
  741. package/dist/primitives/words.js.map +1 -0
  742. package/dist/prose.css +1917 -0
  743. package/dist/registry.d.ts +182 -0
  744. package/dist/registry.js +2 -0
  745. package/dist/registry.js.map +1 -0
  746. package/dist/shape.css +21 -0
  747. package/dist/skeleton.css +428 -0
  748. package/dist/steps.css +231 -0
  749. package/dist/steps.d.ts +6 -0
  750. package/dist/steps.js +156 -0
  751. package/dist/steps.js.map +1 -0
  752. package/dist/styles/icons.d.ts +62 -0
  753. package/dist/styles/icons.js +237 -0
  754. package/dist/styles/icons.js.map +1 -0
  755. package/dist/styles/product-text.d.ts +66 -0
  756. package/dist/styles/product-text.js +114 -0
  757. package/dist/styles/product-text.js.map +1 -0
  758. package/dist/styles/registered-properties.d.ts +6 -0
  759. package/dist/styles/registered-properties.js +68 -0
  760. package/dist/styles/registered-properties.js.map +1 -0
  761. package/dist/styles/shape.d.ts +59 -0
  762. package/dist/styles/shape.js +95 -0
  763. package/dist/styles/shape.js.map +1 -0
  764. package/dist/systems/cupertino.css +8793 -0
  765. package/dist/systems/m3-expressive-like.css +8786 -0
  766. package/dist/systems/m3-like.css +8748 -0
  767. package/dist/table-of-contents.css +482 -0
  768. package/dist/table.css +902 -0
  769. package/dist/tanrei.bundle.js +26644 -0
  770. package/dist/tanrei.bundle.js.map +7 -0
  771. package/dist/text.css +104 -0
  772. package/dist/timeline.css +410 -0
  773. package/dist/timeline.d.ts +6 -0
  774. package/dist/timeline.js +176 -0
  775. package/dist/timeline.js.map +1 -0
  776. package/dist/tokens.css +8801 -0
  777. package/dist/tree-view.css +797 -0
  778. package/dist/words.d.ts +2 -0
  779. package/dist/words.js +6 -0
  780. package/dist/words.js.map +1 -0
  781. package/package.json +132 -3
@@ -0,0 +1,2120 @@
1
+ import { LitElement, html, nothing } from 'lit';
2
+ import { ifDefined } from 'lit/directives/if-defined.js';
3
+ import { AvailabilityController, GlyphDrawnController, GlyphMirrorController, FALLBACK_LOCALE, NativeTextController, FieldControlController, OpenAxesController, ambientLocale, asciiDigits, hostAria, isoValue, parseValues, readText, report, supportedLocale, syncFocusStyle, withinRange, WordsController, } from '../../primitives/index.js';
4
+ import { missingValueMessage } from '../../primitives/missing-value.js';
5
+ import { EMPTY_SEGMENTS, PAGE, SEPARATORS, edged, erased, fill, holds, periodTyped, placeholderOf, rowOf, rowText, segmentsOf, shownOf, sizersOf, spoken, stepped, typed, valueOf, } from './text-input-segments.js';
6
+ import { formOf, pressDefaultButton } from '../../primitives/default-button.js';
7
+ import { FormSays } from '../../primitives/form-says.js';
8
+ import { takeFormDisabled } from '../../primitives/form-disabled.js';
9
+ import { AXES, INSET, styles } from './text-input.styles.js';
10
+ import { runDirection } from '../../styles/product-text.js';
11
+ import { disabledWaitsWhileFocused } from '../../primitives/disabled-while-focused.js';
12
+ import { focusedAtFirst } from '../../primitives/autofocus.js';
13
+ /** `disabled-dates`: a space-separated list or a JSON array (src/primitives/values.ts). An element composed around the input declares the same converter. */
14
+ export const DISABLED_DATES = { fromAttribute: parseValues, toAttribute: (value) => value.join(' ') };
15
+ const RESIZES = ['auto', 'manual', 'fixed'];
16
+ const RESIZE_AXES = ['vertical', 'both'];
17
+ /** A press on the resize grip that ends within this many pixels of where it began is a click, not a drag (TXI-41). */
18
+ const DRAG_SLOP = 3;
19
+ /** The Button sizes every design system has: the picker button takes the field's size name where Button has it (TXI-32). */
20
+ const BUTTON_SIZES = new Set(['small', 'medium', 'large']);
21
+ /**
22
+ * TXI-20: how each type is given to the browser. The native element's own type is used only where it adds nothing the
23
+ * field must not do: an `email` or `url` input would validate and trim the value, and a `number` input would parse it,
24
+ * so those are text inputs with the matching keyboard (`inputmode`). Values that read left to right are laid out so in
25
+ * a right-to-left field (TXI-24). `code` (TXI-53 to TXI-55) is the general case of a value that is not prose: a general
26
+ * keyboard, nothing the browser would do to words, and an input line that is left to right and begins at the left.
27
+ */
28
+ const TYPES = {
29
+ text: { type: 'text' },
30
+ email: { type: 'text', inputmode: 'email', plain: true, ltr: true },
31
+ password: { type: 'password', plain: true, ltr: true },
32
+ number: { type: 'text', inputmode: 'decimal', ltr: true },
33
+ search: { type: 'search', enterkeyhint: 'search' },
34
+ tel: { type: 'tel', inputmode: 'tel', ltr: true },
35
+ url: { type: 'text', inputmode: 'url', plain: true, ltr: true },
36
+ code: { type: 'text', plain: true, ltr: true, code: true },
37
+ // TXI-20, TXI-28: a row of segments in the locale's numeric form, never the native date and time inputs (the web's note).
38
+ date: { type: 'text', plain: true, date: 'date' },
39
+ time: { type: 'text', plain: true, date: 'time' },
40
+ 'date-time': { type: 'text', plain: true, date: 'date-time' },
41
+ };
42
+ let segmenter;
43
+ /** The user-perceived characters of a string (grapheme clusters: an emoji, or a letter with its accents, is one). */
44
+ function graphemes(text) {
45
+ if (segmenter === undefined) {
46
+ const Intl_ = Intl;
47
+ segmenter = Intl_.Segmenter ? new Intl_.Segmenter(undefined, { granularity: 'grapheme' }) : null;
48
+ }
49
+ return segmenter ? Array.from(segmenter.segment(text), (s) => s.segment) : Array.from(text);
50
+ }
51
+ /**
52
+ * TXI-18: the value an edit from `before` to `after` may leave under a limit of `max` user-perceived characters. The edit
53
+ * is what differs between the two (the text between their common start and common end); what it inserted is cut to the
54
+ * characters that still fit — nothing, for a keystroke at the limit — so a paste is shortened and a keystroke refused.
55
+ */
56
+ function fit(before, after, max) {
57
+ let start = 0;
58
+ while (start < before.length && start < after.length && before[start] === after[start])
59
+ start++;
60
+ let end = 0;
61
+ while (end < before.length - start && end < after.length - start && before[before.length - 1 - end] === after[after.length - 1 - end])
62
+ end++;
63
+ // Never split a character: move the edges out to whole grapheme boundaries of the new value.
64
+ const bounds = [0];
65
+ for (const g of graphemes(after))
66
+ bounds.push(bounds[bounds.length - 1] + g.length);
67
+ start = Math.max(...bounds.filter((b) => b <= start));
68
+ const tail = Math.min(...bounds.filter((b) => b >= after.length - end));
69
+ const head = after.slice(0, start);
70
+ const rest = after.slice(tail);
71
+ const room = Math.max(0, max - graphemes(head).length - graphemes(rest).length);
72
+ const inserted = graphemes(after.slice(start, tail)).slice(0, room).join('');
73
+ return { value: head + inserted + rest, caret: head.length + inserted.length };
74
+ }
75
+ /**
76
+ * The promise of the page's faces (`document.fonts.ready`), taken once for all the fields of a turn: the getter has the
77
+ * browser bring the page's style up to date, and each field asked in its own first update, after writing its own
78
+ * shadow tree — one style pass and one layout for each field.
79
+ */
80
+ /** A scroll height is a whole number of pixels and a line may not be: within a twentieth of a line it is that many lines. */
81
+ const wholeLines = (lines) => (Math.abs(lines - Math.round(lines)) < 0.05 ? Math.max(1, Math.round(lines)) : Math.max(1, lines));
82
+ /**
83
+ * TXI-17, TXI-38: the fields whose height is fitted without motion in this turn — the first height of each, one that
84
+ * follows a prop, one that follows the faces' arrival — fitted together: every field takes one step of `fitting()`
85
+ * before any takes the next, so all of them read, then all write. Still in the task that drew them, before any frame.
86
+ */
87
+ const toFit = new Set();
88
+ function fitTogether(field) {
89
+ if (!toFit.size) {
90
+ queueMicrotask(() => {
91
+ let fits = [...toFit].filter((each) => each.isConnected).map((each) => each.fitting(false));
92
+ toFit.clear();
93
+ while (fits.length)
94
+ fits = fits.filter((fit) => !fit.next().done);
95
+ });
96
+ }
97
+ toFit.add(field);
98
+ }
99
+ let faces;
100
+ function facesArrived() {
101
+ if (faces === undefined) {
102
+ faces = typeof document === 'undefined' ? null : (document.fonts?.ready ?? null);
103
+ queueMicrotask(() => (faces = undefined));
104
+ }
105
+ return faces;
106
+ }
107
+ /**
108
+ * TXI-13: the lines a copy of the label is laid out in, and the width of the widest, in the copy's own (untransformed)
109
+ * pixels. Each line is the run of text fragments that share a vertical band; a field that is not laid out has one line.
110
+ */
111
+ function labelLines(copy) {
112
+ if (!copy)
113
+ return { count: 1, widest: 0 };
114
+ const range = document.createRange();
115
+ range.selectNodeContents(copy);
116
+ const lines = [];
117
+ const rects = Array.from(range.getClientRects())
118
+ .filter((rect) => rect.width > 0 && rect.height > 0)
119
+ .sort((a, b) => a.top - b.top);
120
+ for (const rect of rects) {
121
+ const middle = (rect.top + rect.bottom) / 2;
122
+ const line = lines.find((l) => middle >= l.top && middle <= l.bottom);
123
+ if (line) {
124
+ line.left = Math.min(line.left, rect.left);
125
+ line.right = Math.max(line.right, rect.right);
126
+ }
127
+ else
128
+ lines.push({ top: rect.top, bottom: rect.bottom, left: rect.left, right: rect.right });
129
+ }
130
+ // An ancestor may be scaled (a dialog opening): the widths are wanted in the copy's own pixels.
131
+ const box = copy.getBoundingClientRect().width;
132
+ const own = Number.parseFloat(getComputedStyle(copy).width);
133
+ const scale = box > 0 && own > 0 ? box / own : 1;
134
+ return { count: Math.max(1, lines.length), widest: Math.max(0, ...lines.map((l) => (l.right - l.left) / scale)) };
135
+ }
136
+ /**
137
+ * The box people type in, and everything typed in it — one line, or several that follow the text or are resized by
138
+ * hand, or a date or a time entered unit by unit in the locale's form — with optional icons, a prefix and a suffix, a
139
+ * picker button, and, in the two looks that have one, the label that floats inside the box. It has no label row, no
140
+ * help and no error text of its own: put it in a `<tanrei-field>`, which names it, describes it and marks it — or use
141
+ * `<tanrei-text-field>`, which is the two as one element. Bare, it is for a place whose label stands elsewhere: a
142
+ * filter in a toolbar, a cell of a table, a row with its label beside it; give it `label` there.
143
+ *
144
+ * Contract: specs/text-input.spec.json. `<tanrei-field label="Email"><tanrei-text-input name="email" type="email">
145
+ * </tanrei-text-input></tanrei-field>`, or bare: `<tanrei-text-input name="q" type="search" label="Filter tokens">
146
+ * </tanrei-text-input>`. The box is drawn from `--tanrei-comp-input-box-*`, the one set of
147
+ * tokens every input box is drawn from (TXI-68), one set per variant, look (plain or error) and state — how a state
148
+ * looks is the active design system's decision — and what a text input alone draws (the resize grip, a segment, the
149
+ * code face, the entries place) from `--tanrei-comp-text-input-*`. The text is edited in a native
150
+ * `<input>` — a `<textarea>` while `multiline` — in the shadow root, so input methods, autofill,
151
+ * selection and the clipboard work as the browser does. The name (its own `label`, else its Field's), the description
152
+ * (the prefix and the suffix while shown, the count, then what its Field gives) and the invalid, required, read-only
153
+ * and disabled states are set on that element.
154
+ *
155
+ * It is a block as wide as its place, framed and bare alike (TXI-63): it has no width of its own. A narrower box is a
156
+ * narrower place.
157
+ *
158
+ * It tells the Field around it what only it knows, through the Field's own connection (`src/primitives/field.ts`):
159
+ * that it draws the label itself while its look floats one, how far its text stands from its edges — the Field's
160
+ * supporting row starts and ends there — and its own refusal of a date or a time, with its words (TXI-62). It takes
161
+ * from that Field its name, its description, the required, invalid and disabled states, whether the label is hidden,
162
+ * and whether an asterisk follows a floating label. `countText` is the count it keeps while `counter` is set, as text
163
+ * ("12/40"): it describes and announces the count and draws none — a Field draws it, given it as `count-text`.
164
+ *
165
+ * `stacked` (the default) draws no label — the label above it is its Field's row — and marks focus and error with a
166
+ * line inside the container's edge; `filled` and `outlined` float the label inside the box. A design system may leave some out
167
+ *: they still work, and a debug build says so.
168
+ *
169
+ * `multiline` with `resize="auto"` (the default) follows its lines between `min-rows` and `max-rows` with an animated
170
+ * height; `resize="manual"` draws a grip in the bottom end corner that is dragged, moved with the arrow keys, or
171
+ * activated to fit the text (`resize-axis="both"` resizes the width too); `resize="fixed"` stays at `min-rows`.
172
+ *
173
+ * `type="code"` is a field whose value is written for a machine — a pattern, a key, a snippet of configuration — on one
174
+ * line or, with `multiline`, on many: the input line (prefix, value, placeholder, suffix) is one left-to-right row in
175
+ * the code face that begins at the left in every layout direction, while the label, the icons, the messages and the
176
+ * grip follow the page; the browser is asked not to correct, capitalise, spell-check, translate or complete it; a paste
177
+ * is plain text, character for character; Tab still moves focus. `no-wrap` keeps each line of a multi-line code field
178
+ * on one row and scrolls it sideways inside the container. It is a field, not an editor: no syntax colors, no line
179
+ * numbers, no Tab that indents.
180
+ *
181
+ * `date`, `time` and `date-time` are the stated exception to the native element: a row of segments — one spin button
182
+ * per unit, in the locale's order — that are focused, stepped, typed into and cleared on their own, held as ISO 8601
183
+ * (`2026-09-27`, `14:30`, `2026-09-27T14:30`) or empty while a segment is empty or the value is not available. A whole
184
+ * date can be pasted. With `picker`, the field shows a picker button that asks the product to present a picker
185
+ * (`pickerrequest`); the field presents none itself.
186
+ *
187
+ * Form-associated: with a `name` it submits `value`, resets to its `value` attribute, restores on navigation, joins
188
+ * constraint validation (a missing value while its Field says it is required; a date or time field's entry error as badInput,
189
+ * rangeUnderflow, rangeOverflow or a custom error) and is left out while disabled — its own or a `<fieldset>`'s.
190
+ *
191
+ * @tag tanrei-text-input
192
+ * @slot leading-icon - An icon at the start of the field: a glyph name of the system's icon set, an `<svg>` or an `<img>`. A glyph the icon set flags as showing a direction (`arrow_forward`, `send`) is drawn mirrored in a right-to-left layout. `data-mirror="auto | always | never"` on the element decides for one use.
193
+ * @slot trailing-icon - An icon at the end of the field, or the product's own icon-only Button (clear, reveal password). A date or time field's picker button comes after it. A glyph is mirrored in right-to-left as in `leading-icon`.
194
+ * @slot entries - What was entered already — the product's own elements, or the chips of a component that holds the input (a chip field): laid out inside the box before the typing part, in lines that wrap (TXI-64). The text input gives them no role, no focus order and no key (TXI-66).
195
+ * @csspart container - The box around the input: its fill, corners and hover state layer.
196
+ * @csspart outline - The outlined variant's border (with the gap for the floated label); a stacked field's inner line.
197
+ * @csspart active-indicator - The filled variant's bottom line.
198
+ * @csspart label - The label that floats in a filled or an outlined box.
199
+ * @csspart requirement-label - The required asterisk after a floating label.
200
+ * @csspart input - The native `<input>` or `<textarea>`; a date, time or date-time field's row of segments.
201
+ * @csspart entries - What was entered already, before the typing part: the content of the `entries` slot. The text input lays it out and draws none of it, so the part has no box of its own.
202
+ * @csspart segment - One unit of a date or a time: a spin button in the row.
203
+ * @csspart prefix - The fixed text before the value.
204
+ * @csspart suffix - The fixed text after the value.
205
+ * @csspart leading-icon - The box of the leading icon.
206
+ * @csspart trailing-icon - The box of the trailing icon.
207
+ * @csspart picker-button - The picker button, a `<tanrei-button>` (TXI-32).
208
+ * @csspart resize-grip - The grip of a multi-line field resized by hand (TXI-39).
209
+ * @attr {string} form - The id of the form the text input belongs to, where it stands outside it: the platform's own attribute, which then wins over a form around it. The `form` property is read-only and returns the form element.
210
+ * @fires input - The user changed the value (typing, deleting, pasting, dictation, autofill, an input method); `value` is already the new one. A date or time field fires it when its value changes — its last segment is filled, a filled row is edited, or it is emptied — not for a segment that leaves the value empty. Never fired when the product sets `value`.
211
+ * @fires change - The user committed a changed value: focus left the field (a date or time field's segments and picker button), or the action key was pressed in a single-line field.
212
+ * @fires {CustomEvent<TanreiTextInputActionDetail>} action - The action key (Enter) was pressed in a single-line field. Cancelable: cancelling it keeps an enclosing form from being submitted.
213
+ * @fires {CustomEvent<TanreiTextInputPickerRequestDetail>} pickerrequest - The user activated the picker button of a date, time or date-time field. The product presents the picker and sets `value` to the picked value.
214
+ * @fires {CustomEvent<TanreiTextInputEntryErrorDetail>} entryerror - The user committed a date, time or date-time field that is half-filled (`invalid`) or whose value is not available (`unavailable`: before `min`, after `max` or listed in `disabledDates`), with the row's text as drawn.
215
+ */
216
+ export class TanreiTextInput extends LitElement {
217
+ constructor() {
218
+ super(...arguments);
219
+ this.availability = new AvailabilityController(this, 'text-input');
220
+ /**
221
+ * TXI-35: the glyphs in the leading-icon and trailing-icon slots are marked when the icon set mirrors
222
+ * their names in right-to-left, or the product's `data-mirror` says so (src/primitives/glyph-mirror.ts);
223
+ * `iconGlyph()` draws the mark. The picker button's glyph is its Button's (TXI-32) and is not one the icon set flags,
224
+ * and the resize grip's glyphs are never marked.
225
+ */
226
+ this.mirror = new GlyphMirrorController(this, { slots: 'slot[name="leading-icon"], slot[name="trailing-icon"]' });
227
+ /**
228
+ * TXI-22, TXI-39: the resize grip's glyph is drawn once the icon set can draw it; until then nothing stands in its
229
+ * place — not its name spelled out in a text face (src/primitives/glyph.ts).
230
+ */
231
+ this.gripGlyph = new GlyphDrawnController(this, () => this.renderRoot.querySelectorAll('.grip-glyph'));
232
+ /**
233
+ * TXI-62: the input's side of the exchange with the Field that frames it (src/primitives/field.ts). It takes the
234
+ * Field's name, description and states, whether the label is hidden and whether an asterisk follows it; and it says
235
+ * what only it knows — that it draws the label, how far its text is inset, its own refusal of an entry. It has an
236
+ * error condition of its own (TXI-11). No Field: it is drawn as a bare input.
237
+ */
238
+ this.frame = new FieldControlController(this, {
239
+ errorCondition: true,
240
+ named: () => !!this.label.trim(),
241
+ says: () => this.saysToField,
242
+ changed: () => (this.frameChanged = true),
243
+ });
244
+ /** The Field's answer changed since the last update: the floating label may have other lines (TXI-13). */
245
+ this.frameChanged = false;
246
+ /**
247
+ * Stacked is a filled box that shows focus and error with a line inside its edge, under the label its Field draws
248
+ * above it; filled and outlined float the label inside the box, marked by a tinted box and a bottom line, or by a
249
+ * border. Use one style
250
+ * per form. A design system may leave some out (the default system ships stacked only) or add values.
251
+ */
252
+ this.variant = 'stacked';
253
+ /** Minimum height of a single-line field's container (48 / 56 in the default system). The hit area always meets the minimum target. */
254
+ this.size = 'medium';
255
+ /**
256
+ * What the value is: chooses the keyboard, autocorrection, obscured entry and semantics. `code` is text written for
257
+ * a machine rather than for a reader — a snippet of configuration, a pattern, an identifier, a query, a key: a
258
+ * left-to-right run in the code face that the browser does not correct, capitalise, check for spelling or complete,
259
+ * on one line or, with `multiline`, on many. `date`, `time` and `date-time` are entered segment by segment in the
260
+ * locale's numeric form. The value is always a string.
261
+ */
262
+ // The union is written out (it is `TanreiTextInputType`): the manifest then lists the values this build reads, and
263
+ // what draws a spec's fixtures can tell a value the build does not know yet from one it does.
264
+ this.type = 'text';
265
+ /** The value the element holds: what the product set, or the person's last edit as the element took it. */
266
+ this.held = '';
267
+ /** The native text element, once drawn (none for a row of segments), and what it held when the element last wrote to it or took from it. */
268
+ this.nativeInput = null;
269
+ /** The input's own accessible name, for an input no Field frames or one whose visible label is elsewhere; a filled or an outlined input draws it floating. Inside a Field leave it empty: the Field's label names the input, and its own would win. */
270
+ this.label = '';
271
+ /** Does not draw the floating label of a filled or an outlined input, which stays the accessible name (the `label-hidden` attribute). Inside a Field, hide the label on the Field. */
272
+ this.labelHidden = false;
273
+ /**
274
+ * A hint shown while the value is empty and the label is not in the input line (above, floated or hidden). Never a
275
+ * replacement for `label`. In a code field it is an example of the code and is drawn as code; a hint in words
276
+ * belongs in its Field's `supportingText`. Ignored by a date, time or date-time field, whose empty segments each show their own.
277
+ */
278
+ this.placeholder = '';
279
+ /**
280
+ * Puts the input in the error condition: its error parts are drawn and it is exposed as invalid. For a bare input;
281
+ * inside a Field set `error` on the Field, which marks the input and shows the words. Validation is the product's:
282
+ * the input never sets this itself.
283
+ */
284
+ this.error = false;
285
+ /** Prevents focus, editing and form submission. Inside a Field, disable the Field, so that its label follows. */
286
+ this.disabled = false;
287
+ /** The value can be focused, selected and copied, but not changed (the `readonly` attribute). */
288
+ this.readOnly = false;
289
+ /** Accepts line breaks and shows several lines, sized as `resize` says. Ignored for password, date, time and date-time. */
290
+ this.multiline = false;
291
+ /**
292
+ * The fewest lines a multi-line field shows (`min-rows`): the height of an empty auto-resized field, the starting and
293
+ * smallest height of a manually resized one, and the height of a fixed one.
294
+ */
295
+ this.minRows = 2;
296
+ /**
297
+ * The most lines an auto-resized field grows to before it scrolls, and the tallest a manually resized one can be made
298
+ * (`max-rows`); 0 is no limit. Ignored while `resize` is fixed.
299
+ */
300
+ this.maxRows = 0;
301
+ /**
302
+ * How a multi-line field gets its height. `auto`: it follows the number of lines between `minRows` and `maxRows`, with
303
+ * an animated change, and has no grip. `manual`: it starts at `minRows` lines and the person resizes it with the grip
304
+ * in its bottom end corner. `fixed`: it stays at `minRows` lines, with no grip.
305
+ */
306
+ this.resize = 'auto';
307
+ /** What the person can resize by hand (`resize-axis`): the height only, or the height and the width. Ignored unless `resize` is manual. */
308
+ this.resizeAxis = 'vertical';
309
+ /** The accessible name of the resize grip (`resize-label`): this instance's words, else the product's (`setWords({ resizeLabel })`). Tanrei has none: without them the grip is drawn and works, and has no name. */
310
+ this.resizeLabel = '';
311
+ /**
312
+ * Keeps every line of a multi-line code field on one row (`no-wrap`; the spec's `wrap: false`): a line wider than the
313
+ * input scrolls sideways inside the container, and widens nothing. Without it a line that does not fit continues on
314
+ * following rows; the value is the same either way. Read only while `type` is `code` and `multiline` is set: prose
315
+ * always wraps, and a single line always scrolls in its line (reported in debug builds).
316
+ */
317
+ this.noWrap = false;
318
+ /** The most user-perceived characters the user can enter; 0 is no limit (the `maxlength` attribute). Ignored for date, time and date-time. */
319
+ this.maxLength = 0;
320
+ /** Keeps a character count (with `maxLength`, when set: "12/40"): part of the description, announced when typing pauses, and readable as `countText`. The input draws none: a Field draws it at the end of its supporting row, given it as `count-text` — which `<tanrei-text-field>` does by itself. */
321
+ this.counter = false;
322
+ /** Fixed text before the value, not part of it (`prefix-text`). Beside one line of email, url, tel, number or password it is written before the value along the direction of the run the two affixes make — that of their first strong character, left-to-right where they have none — in every layout direction; beside any other value it stands at the field's start edge. In a code field it is code: in the code face, at the left of the value in every layout direction. Ignored for date, time and date-time. */
323
+ this.prefixText = '';
324
+ /** Fixed text after the value, not part of it (`suffix-text`). Beside one line of email, url, tel, number or password it is written after the value along the run's direction (see `prefixText`); beside any other value it stands at the field's end edge. In a code field it is code: in the code face, at the right of the value in every layout direction. Ignored for date, time and date-time. */
325
+ this.suffixText = '';
326
+ /** The autofill hint, as an HTML autofill field name (email, current-password, one-time-code…). A code field left without one asks the browser to offer no remembered entry. */
327
+ this.autocomplete = '';
328
+ /**
329
+ * A BCP 47 tag ("en-US", "ja-JP") for how a date, time or date-time field shows and reads its value: the order of its
330
+ * segments, the separators, the clock, the digits and the names of the units. Empty uses the nearest `lang`
331
+ * attribute, then the browser's language. The calendar is the Gregorian calendar in every locale.
332
+ */
333
+ this.locale = '';
334
+ /** The earliest value a date, time or date-time field accepts from the person, ISO 8601; empty for no limit. */
335
+ this.min = '';
336
+ /** The latest value a date, time or date-time field accepts from the person, ISO 8601; empty for no limit. */
337
+ this.max = '';
338
+ /**
339
+ * Dates inside `min` and `max` that a date or date-time field does not accept from the person, as ISO 8601 calendar
340
+ * dates — the same list the product gives its date-time picker. The `disabled-dates` attribute is a space-separated
341
+ * list or a JSON array. Ignored by a time field.
342
+ */
343
+ this.disabledDates = [];
344
+ /** The words of the refusal of a date, time or date-time input committed with some segments filled and others empty (`invalid-text`): shown by the Field that frames it as its error text, and part of a bare input's description. */
345
+ this.invalidText = '';
346
+ /** The words of the refusal of a date, time or date-time input committed with a value before `min`, after `max` or listed in `disabledDates` (`unavailable-text`): shown and described as `invalidText` is. */
347
+ this.unavailableText = '';
348
+ /** What assistive technology reads as the value of a date or time segment that holds nothing yet (`segment-empty-text`): this instance's words, else the product's (`setWords({ segmentEmptyText })`). Tanrei has none: without them an empty segment has no value text. */
349
+ this.segmentEmptyText = '';
350
+ /**
351
+ * Shows the picker button in a date, time or date-time field. The field presents no picker itself: it fires
352
+ * `pickerrequest`, and the product presents one and sets `value` to what was picked.
353
+ */
354
+ this.picker = false;
355
+ /** The accessible name of the picker button ("Choose date", `picker-label`). Required while the button is shown. */
356
+ this.pickerLabel = '';
357
+ /** Web only: the name it is submitted under. */
358
+ this.name = '';
359
+ this.hasLeading = false;
360
+ this.hasTrailing = false;
361
+ /** TXI-64, TXI-65: whether the entries slot holds content. */
362
+ this.hasEntries = false;
363
+ this.focused = false;
364
+ /** Set by an ancestor `<fieldset disabled>` (the element's `formDisabledCallback`). */
365
+ this.formDisabled = false;
366
+ /** What a date or time field's segments hold (TXI-42 … TXI-46). */
367
+ this.segments = EMPTY_SEGMENTS;
368
+ /** A date or time field's entry error, while it lasts (TXI-30). */
369
+ this.entryError = null;
370
+ this.internals = this.attachInternals();
371
+ /** What it tells its form, said where an element composed around it hears it (src/primitives/form-says.ts). */
372
+ this.says = new FormSays(this, this.internals);
373
+ /** TXI-9: sizes and variants a design system adds, and a value the active system does not have (src/primitives/axes.ts). */
374
+ this.axes = new OpenAxesController(this, { component: 'text-input', behavior: 'TXI-9', axes: AXES });
375
+ /**
376
+ * TXI-1, TXI-4: the value and the native element kept in step around an input method (src/primitives/native-text.ts).
377
+ * A committed composition is cut to maxLength (TXI-18) from the value it began with. A date or time field has no
378
+ * native element: its segments take what an input method commits (TXI-45).
379
+ */
380
+ this.native = new NativeTextController({
381
+ input: () => this.input,
382
+ value: () => this.value,
383
+ setValue: (text) => this.takeText(text),
384
+ commit: (input, from) => {
385
+ if (this.maxLength <= 0 || graphemes(input.value).length <= this.maxLength)
386
+ return;
387
+ const allowed = fit(from, input.value, this.maxLength);
388
+ input.value = allowed.value;
389
+ this.place(input, allowed.caret);
390
+ },
391
+ settled: () => {
392
+ this.fitHeight(true);
393
+ this.scheduleCount();
394
+ },
395
+ });
396
+ /** TXI-2: the value last committed (when focus arrived, at the last change, or as the product last set it). */
397
+ this.committed = '';
398
+ /** TXI-45: the digits typed since the focused segment took focus. */
399
+ this.typedDigits = '';
400
+ /** TXI-45: an input method is composing on a segment; nothing is taken until it commits. */
401
+ this.composing = false;
402
+ /** TXI-43: focus is on one of the field's segments or on its picker button. */
403
+ this.within = false;
404
+ /** TXI-33: the picker was asked for; focus leaving for it raises no entry error. */
405
+ this.pickerAsked = false;
406
+ /** TXI-39: the lines the person gave a manually resized field; null is minRows. */
407
+ this.manualLines = null;
408
+ /** The lines the input shows (the grip's value, TXI-41). */
409
+ this.lines = 0;
410
+ /** The textarea whose height was last written: a new one is sized without motion (TXI-38). */
411
+ this.sized = null;
412
+ /** TXI-39: a width the person gave the field is on the host's inline style; what it replaced is put back. */
413
+ this.manualWidth = null;
414
+ this.drag = null;
415
+ this.observedInput = null;
416
+ this.lastBox = { width: -1, line: -1 };
417
+ /** TXI-58: the room a sideways scrollbar takes of the input's height, which an auto-resized field adds to its lines. */
418
+ this.bar = 0;
419
+ /** TXI-52: the product's words, read where the instance gives none (src/primitives/words.ts). */
420
+ this.words = new WordsController(this);
421
+ this.observedIcons = [];
422
+ /** The measured length of each icon box while what it holds is wider than an icon; empty while it is an icon's. */
423
+ this.iconBoxes = { lead: '', trail: '' };
424
+ this.observedCopies = [];
425
+ /** Whether the first update has drawn (the first height is shown without motion, TXI-38). */
426
+ this.drawn = false;
427
+ }
428
+ static { this.styles = styles; }
429
+ static { this.formAssociated = true; }
430
+ /**
431
+ * Its documented parts, once: what an element composed around it exports (src/primitives/composed.ts). Held equal to
432
+ * the `@csspart` lines above by src/primitives/composed.test.ts.
433
+ *
434
+ * @internal
435
+ */
436
+ static { this.parts = ['container', 'outline', 'active-indicator', 'label', 'requirement-label', 'input', 'entries', 'segment', 'prefix', 'suffix', 'leading-icon', 'trailing-icon', 'picker-button', 'resize-grip']; }
437
+ static { this.shadowRootOptions = { ...LitElement.shadowRootOptions, delegatesFocus: true }; }
438
+ static { this.properties = {
439
+ variant: { type: String, reflect: true },
440
+ size: { type: String, reflect: true },
441
+ // The default is not reflected: a field that is written without `type` is not given `type="text"` when it is
442
+ // defined. Nothing reads the attribute, and writing it is not free: `type` is a name `:has()` asks about on a page
443
+ // with prose (`li:has(> input[type='checkbox'])`), so a browser walks up from every element that writes it and asks
444
+ // every `:has()` on the way again — a product's `:root:has(…)` is then asked of the whole document, once per field.
445
+ type: { type: String, reflect: true, useDefault: true },
446
+ value: { type: String },
447
+ label: { type: String },
448
+ labelHidden: { type: Boolean, attribute: 'label-hidden', reflect: true },
449
+ placeholder: { type: String },
450
+ error: { type: Boolean, reflect: true },
451
+ disabled: { type: Boolean, reflect: true },
452
+ readOnly: { type: Boolean, attribute: 'readonly', reflect: true },
453
+ multiline: { type: Boolean, reflect: true },
454
+ minRows: { type: Number, attribute: 'min-rows' },
455
+ maxRows: { type: Number, attribute: 'max-rows' },
456
+ resize: { type: String, reflect: true },
457
+ resizeAxis: { type: String, attribute: 'resize-axis', reflect: true },
458
+ resizeLabel: { type: String, attribute: 'resize-label' },
459
+ noWrap: { type: Boolean, attribute: 'no-wrap', reflect: true },
460
+ maxLength: { type: Number, attribute: 'maxlength' },
461
+ counter: { type: Boolean },
462
+ prefixText: { type: String, attribute: 'prefix-text' },
463
+ suffixText: { type: String, attribute: 'suffix-text' },
464
+ autocomplete: { type: String },
465
+ locale: { type: String },
466
+ min: { type: String },
467
+ max: { type: String },
468
+ disabledDates: { attribute: 'disabled-dates', converter: DISABLED_DATES },
469
+ invalidText: { type: String, attribute: 'invalid-text' },
470
+ unavailableText: { type: String, attribute: 'unavailable-text' },
471
+ segmentEmptyText: { type: String, attribute: 'segment-empty-text' },
472
+ picker: { type: Boolean, reflect: true },
473
+ pickerLabel: { type: String, attribute: 'picker-label' },
474
+ name: { type: String, reflect: true },
475
+ hasLeading: { state: true },
476
+ hasTrailing: { state: true },
477
+ hasEntries: { state: true },
478
+ focused: { state: true },
479
+ formDisabled: { state: true },
480
+ segments: { state: true },
481
+ entryError: { state: true },
482
+ }; }
483
+ /**
484
+ * The text in the field; for date, time and date-time, the ISO 8601 form of what its segments give (2026-09-27, 14:30,
485
+ * 2026-09-27T14:30), or empty while a segment is empty or the value is not available. Setting it shows it and fires
486
+ * nothing. The `value` attribute is what a form reset returns to.
487
+ */
488
+ // An accessor, not a field: the value is the person's at every moment. The native `input` event
489
+ // is the browser's own and composed — a capturing listener on an ancestor hears it before the element's own listener
490
+ // has run — so what the person has just done to the native element and the element has not taken yet is read from
491
+ // that element, cut as the element is about to cut it (TXI-18). `event.target.value` is then the new value in every
492
+ // listener, and in every listener of an element composed around this one.
493
+ get value() {
494
+ const native = this.nativeInput;
495
+ return native && native.value !== this.nativeSeen ? this.afterEdit(native.value) : this.held;
496
+ }
497
+ set value(value) {
498
+ this.held = value;
499
+ }
500
+ /** TXI-18: what an edit that left `text` in the native element becomes — itself, or what of it fits under maxLength. A composition is the platform's (TXI-4). */
501
+ afterEdit(text) {
502
+ if (this.native.composing || this.maxLength <= 0 || graphemes(text).length <= this.maxLength)
503
+ return text;
504
+ return fit(this.held, text, this.maxLength).value;
505
+ }
506
+ get input() {
507
+ return this.renderRoot.querySelector('.input');
508
+ }
509
+ get textarea() {
510
+ const input = this.input;
511
+ return input instanceof HTMLTextAreaElement ? input : null;
512
+ }
513
+ /** The kind of a date, time or date-time field, or null for every other type. */
514
+ get dateKind() {
515
+ return (TYPES[this.type] ?? TYPES.text).date ?? null;
516
+ }
517
+ /** TXI-42: the row of segments of a date, time or date-time field in its locale, or null for every other type. */
518
+ get row() {
519
+ const kind = this.dateKind;
520
+ return kind ? rowOf(this.resolvedLocale, kind) : null;
521
+ }
522
+ get isMultiline() {
523
+ return this.multiline && this.type !== 'password' && !this.dateKind;
524
+ }
525
+ /** TXI-53: the field holds code — its input line is one left-to-right row in the code face. */
526
+ get isCode() {
527
+ return this.type === 'code';
528
+ }
529
+ /** TXI-57, TXI-58: the lines of the code are not wrapped — read only by a multi-line code field. */
530
+ get unwrapped() {
531
+ return this.noWrap && this.isCode && this.isMultiline;
532
+ }
533
+ get inert_() {
534
+ return this.disabled || this.formDisabled || this.frame.disabled;
535
+ }
536
+ /** How the variant is laid out: filled and outlined by name, every other value as stacked (TXI-9). */
537
+ get layout() {
538
+ return this.variant === 'filled' || this.variant === 'outlined' ? this.variant : 'stacked';
539
+ }
540
+ /** TXI-17: how a multi-line field gets its height; a value the field does not know is auto. */
541
+ get resizeMode() {
542
+ return RESIZES.includes(this.resize) ? this.resize : 'auto';
543
+ }
544
+ /** TXI-17: what the grip resizes; a value the field does not know is vertical. */
545
+ get axis() {
546
+ return RESIZE_AXES.includes(this.resizeAxis) ? this.resizeAxis : 'vertical';
547
+ }
548
+ /** TXI-39: a multi-line field resized by hand draws the grip, read-only too — not while disabled. */
549
+ get gripShown() {
550
+ return this.isMultiline && this.resizeMode === 'manual' && !this.inert_;
551
+ }
552
+ /** TXI-17: the fewest lines; a minRows below 1 is 1. */
553
+ get minLines() {
554
+ return Math.max(1, Number(this.minRows) || 1);
555
+ }
556
+ /** TXI-37, TXI-39: the most lines, or 0 for no limit; never fewer than minRows, and minRows itself while fixed. */
557
+ get maxLines() {
558
+ if (this.resizeMode === 'fixed')
559
+ return this.minLines;
560
+ return this.maxRows > 0 ? Math.max(this.minLines, Number(this.maxRows)) : 0;
561
+ }
562
+ /** TXI-41, TXI-52: the grip's name — the instance's, else the product's words, else nothing. */
563
+ get gripName() {
564
+ return this.words.get('resizeLabel', this.resizeLabel).trim();
565
+ }
566
+ /** TXI-23: the validity message of a date or a time its Field says is required, left empty — the browser's, else the Field's words. */
567
+ missingMessage() {
568
+ return missingValueMessage('text', { errorText: '', requiredText: this.frame.state?.requiredText ?? '', label: this.name_ });
569
+ }
570
+ /** TXI-23: the accessible name — its own label, else the label of the Field that frames it. */
571
+ get name_() {
572
+ return this.frame.name(this.label.trim() ? this.label : '');
573
+ }
574
+ /** TXI-23: its Field says it is required. It has no requirement of its own. */
575
+ get required_() {
576
+ return this.frame.required;
577
+ }
578
+ /** TXI-13: the label floats in the box — a filled or an outlined input with a name, unless its own `labelHidden` or its Field's says to draw none. */
579
+ get labelled() {
580
+ return this.layout !== 'stacked' && !!this.name_ && !this.labelHidden && !this.frame.labelHidden;
581
+ }
582
+ /** TXI-50: an asterisk follows the floating label — the Field's answer (FLD-25); never outside a Field. */
583
+ get asterisked() {
584
+ return this.labelled && this.frame.requiredMark === 'asterisk';
585
+ }
586
+ /**
587
+ * TXI-62: what the input says to the Field that frames it. That it draws the label while its look floats one — its
588
+ * name, or nothing while the label is hidden; the Field draws no label row either way. How far its text stands from
589
+ * its start edge and the padding it keeps at its end edge, as lengths of its own tokens (`INSET`, in the styles).
590
+ * And an entry error, with its words.
591
+ */
592
+ get saysToField() {
593
+ const size = /^[a-z0-9][a-z0-9-]*$/.test(this.size) ? this.size : 'medium';
594
+ return {
595
+ drawsLabel: this.layout !== 'stacked',
596
+ inset: INSET(size, { leading: this.hasLeading, trailing: this.hasTrailing || this.pickerShown, lead: this.iconBoxes.lead }),
597
+ refusal: this.entryError ? { text: this.refusalText } : null,
598
+ };
599
+ }
600
+ /** TXI-30: the words of an entry error while it lasts — invalidText or unavailableText; empty where the product gave none. */
601
+ get refusalText() {
602
+ return this.entryError ? (this.entryError.reason === 'invalid' ? this.invalidText : this.unavailableText) : '';
603
+ }
604
+ /**
605
+ * TXI-23, TXI-30: what the input adds to its own description (the prefix, the suffix and the count are named by id):
606
+ * the words of an entry error while no Field frames it — a Field shows them and gives them back as its own
607
+ * description (FLD-28) — and then the description its Field gives.
608
+ */
609
+ get described() {
610
+ return [this.frame.framed ? '' : this.refusalText, this.frame.description()].filter(Boolean).join(' ');
611
+ }
612
+ /** What the field shows as text: a date or time field's row as drawn, every other field's value. */
613
+ get shownValue() {
614
+ const row = this.row;
615
+ return row ? rowText(row, this.segments) : this.value;
616
+ }
617
+ /** The locale a date or time field reads and writes in (TXI-28): `locale`, else the nearest `lang`, else the browser's. */
618
+ get resolvedLocale() {
619
+ const tag = this.locale.trim();
620
+ if (!tag)
621
+ return ambientLocale(this);
622
+ return supportedLocale(tag) ?? FALLBACK_LOCALE;
623
+ }
624
+ /** `min` and `max` as ISO values of the kind, or empty (TXI-31: anything else is treated as empty). */
625
+ limit(which) {
626
+ const kind = this.dateKind;
627
+ const text = this[which];
628
+ return kind && text && isoValue(kind, text) ? text : '';
629
+ }
630
+ /** TXI-31: the entries of `disabledDates` that are ISO 8601 calendar dates; a time field has none. */
631
+ get listedDates() {
632
+ if (!this.dateKind || this.dateKind === 'time')
633
+ return new Set();
634
+ return new Set((this.disabledDates ?? []).filter((entry) => typeof entry === 'string' && isoValue('date', entry)));
635
+ }
636
+ /** TXI-46: why an ISO value the row gives is not available — before min, after max, a listed date — or null when it is. */
637
+ unavailable(value) {
638
+ const [min, max] = [this.limit('min'), this.limit('max')];
639
+ if (min && value < min)
640
+ return 'under';
641
+ if (max && value > max)
642
+ return 'over';
643
+ if (!withinRange(value, min, max))
644
+ return 'over';
645
+ return this.listedDates.has(value.slice(0, 10)) ? 'listed' : null;
646
+ }
647
+ /** The form it belongs to, if any. */
648
+ get form() {
649
+ return this.internals.form;
650
+ }
651
+ /** The native constraint validity (a required field's missing value; a date or time field's entry error), as a form sees it. */
652
+ get validity() {
653
+ return this.internals.validity;
654
+ }
655
+ /** The message of an invalid input, as a form shows it. */
656
+ get validationMessage() {
657
+ return this.internals.validationMessage;
658
+ }
659
+ /** Whether the input is validated with its form: not while disabled. */
660
+ get willValidate() {
661
+ return this.internals.willValidate;
662
+ }
663
+ checkValidity() {
664
+ return this.internals.checkValidity();
665
+ }
666
+ reportValidity() {
667
+ return this.internals.reportValidity();
668
+ }
669
+ /** TXI-8, TXI-43: focus given to the element goes to what takes the typing — the native element, or the segment a press would focus. */
670
+ focus(options) {
671
+ const target = this.inert_ ? null : this.entryTarget;
672
+ if (target)
673
+ target.focus(options);
674
+ else
675
+ super.focus(options);
676
+ }
677
+ /** Selects the whole value, as a native input's `select()` does. A date or time field has nothing to select: its first segment takes focus. */
678
+ select() {
679
+ if (this.row)
680
+ this.renderRoot.querySelector('.segment')?.focus();
681
+ else
682
+ this.input?.select();
683
+ }
684
+ formResetCallback() {
685
+ this.value = this.getAttribute('value') ?? '';
686
+ this.showValue();
687
+ this.committed = this.value;
688
+ }
689
+ formStateRestoreCallback(state) {
690
+ this.value = typeof state === 'string' ? state : '';
691
+ this.showValue();
692
+ }
693
+ formDisabledCallback(disabled) {
694
+ takeFormDisabled(this, disabled, (value) => (this.formDisabled = value));
695
+ }
696
+ // ── Dates and times (TXI-28 … TXI-33, TXI-42 … TXI-47) ────────────────────────────────────────────────────────
697
+ /** TXI-28, TXI-31: the value as the product set it fills every segment (an empty one empties them); any entry error ends. */
698
+ showValue() {
699
+ this.userValue = undefined;
700
+ this.entryError = null;
701
+ const row = this.row;
702
+ if (!row)
703
+ return;
704
+ this.segments = segmentsOf(row, this.value);
705
+ this.typedDigits = '';
706
+ }
707
+ /** TXI-1: the person gave the native element this text; it is the value. */
708
+ takeText(text) {
709
+ this.nativeSeen = this.nativeInput?.value;
710
+ this.value = text;
711
+ this.userValue = text;
712
+ }
713
+ /**
714
+ * TXI-45, TXI-46: an edit of a segment. The entry error ends with it (TXI-30); the value is the ISO form of what the
715
+ * row now gives while every segment is filled and that is available, and empty otherwise; `input` is emitted once
716
+ * when — and only when — the value changed.
717
+ */
718
+ edit(next, typedDigits = '') {
719
+ const row = this.row;
720
+ if (!row || this.readOnly || this.inert_)
721
+ return;
722
+ this.typedDigits = typedDigits;
723
+ this.segments = next;
724
+ this.entryError = null;
725
+ const given = valueOf(row, next);
726
+ const value = given && !this.unavailable(given) ? given : '';
727
+ if (value === this.value)
728
+ return;
729
+ this.value = value;
730
+ this.userValue = value;
731
+ this.dispatchEvent(new Event('input', { bubbles: true, composed: true }));
732
+ this.scheduleCount();
733
+ }
734
+ /**
735
+ * TXI-30: a committed date or time field. A row with some segments filled and others empty, or a whole one whose
736
+ * value is not available, keeps its segments and begins an entry error; an empty row, and a row that gives an
737
+ * available value, begin none. Returns the entry error that began, if one did (a commit of the same row again begins none).
738
+ */
739
+ commitEntry() {
740
+ const row = this.row;
741
+ if (!row)
742
+ return null;
743
+ const { held } = fill(row, this.segments);
744
+ if (held === 0)
745
+ return null;
746
+ const given = valueOf(row, this.segments);
747
+ // A value the product set is not checked (TXI-31): only a row the person left without a value is.
748
+ if (given && this.value)
749
+ return null;
750
+ const side = given ? (this.unavailable(given) ?? undefined) : undefined;
751
+ if (given && !side)
752
+ return null;
753
+ const next = { reason: given ? 'unavailable' : 'invalid', text: rowText(row, this.segments), side };
754
+ if (this.entryError?.text === next.text && this.entryError.reason === next.reason)
755
+ return null;
756
+ this.entryError = next;
757
+ return next;
758
+ }
759
+ get segmentElements() {
760
+ return Array.from(this.renderRoot.querySelectorAll('.segment'));
761
+ }
762
+ /** The segment that has focus, if one has. */
763
+ get activeSegment() {
764
+ const active = this.renderRoot.activeElement;
765
+ return active instanceof HTMLElement && active.classList.contains('segment') ? active : null;
766
+ }
767
+ /** TXI-43: focus moves to the segment `by` places along the row, stopping at its ends; returns the segment it moved to. */
768
+ moveFocus(from, by) {
769
+ const all = this.segmentElements;
770
+ const to = all[all.indexOf(from) + by] ?? null;
771
+ to?.focus();
772
+ return to;
773
+ }
774
+ /**
775
+ * TXI-42: each segment's text is written by the field alone — never by a template the browser's editing could
776
+ * disagree with, and never into a composition (TXI-45).
777
+ */
778
+ paintSegments() {
779
+ const row = this.row;
780
+ if (!row || this.composing)
781
+ return;
782
+ for (const element of this.segmentElements) {
783
+ const text = shownOf(row, this.segments, element.dataset.unit);
784
+ if (element.textContent !== text)
785
+ element.textContent = text;
786
+ }
787
+ const active = this.activeSegment;
788
+ if (active)
789
+ this.placeCaret(active);
790
+ }
791
+ /** The (invisible) caret at the end of the focused segment's text, so a touch keyboard's Backspace has something to delete. */
792
+ placeCaret(segment) {
793
+ if (segment.contentEditable !== 'true')
794
+ return;
795
+ try {
796
+ const selection = this.renderRoot.getSelection?.() ?? getSelection();
797
+ selection?.collapse(segment, segment.childNodes.length);
798
+ }
799
+ catch {
800
+ // A browser that cannot place a selection in a shadow root keeps the caret where it put it.
801
+ }
802
+ }
803
+ /** TXI-29: text handed to the field whole — pasted, dictated, autofilled — fills every segment when it reads as a value of the type. */
804
+ takeWhole(text) {
805
+ const row = this.row;
806
+ if (!row || this.readOnly || this.inert_)
807
+ return false;
808
+ const value = readText(row.locale, row.kind, text.trim());
809
+ if (!value)
810
+ return false;
811
+ this.edit(segmentsOf(row, value));
812
+ this.segmentElements.at(-1)?.focus();
813
+ return true;
814
+ }
815
+ /**
816
+ * TXI-45: one character on a segment (the focused one). A digit is the next digit of its number, and focus moves on
817
+ * once no further digit could extend it; a separator's character moves on from a segment that is not empty; a or p, or
818
+ * the first letter of the locale's names, set a day period. Every other character is ignored. Returns the segment the
819
+ * next character goes to.
820
+ */
821
+ typeCharacter(character, segment = this.activeSegment) {
822
+ const row = this.row;
823
+ if (!row || !segment || this.readOnly || this.inert_)
824
+ return segment;
825
+ const unit = segment.dataset.unit;
826
+ // Focus moves on only from the segment that has it (text an input method commits may arrive after focus left).
827
+ const onward = () => (segment === this.activeSegment ? (this.moveFocus(segment, 1) ?? segment) : segment);
828
+ if (unit !== 'period' && /^[0-9]$/.test(character)) {
829
+ const result = typed(row, this.segments, unit, this.typedDigits, character);
830
+ this.edit(result.segments, result.typed);
831
+ return result.advance ? onward() : segment;
832
+ }
833
+ const following = row.parts[row.parts.findIndex((part) => part.unit === unit) + 1]?.literal ?? '';
834
+ if ((SEPARATORS.has(character) || (character.trim() && following.includes(character))) && holds(this.segments, unit))
835
+ return onward();
836
+ if (unit === 'period') {
837
+ const period = periodTyped(row, character);
838
+ if (period !== null)
839
+ this.edit({ ...this.segments, period });
840
+ }
841
+ return segment;
842
+ }
843
+ /** The characters of text as typed: full-width and the locale's digits as ASCII ones. */
844
+ characters(text) {
845
+ const row = this.row;
846
+ return Array.from(asciiDigits(row?.locale ?? FALLBACK_LOCALE, text.normalize('NFKC')));
847
+ }
848
+ /**
849
+ * TXI-45: the browser is about to edit a segment. Nothing it would write is kept — the segment's text is the field's
850
+ * — and what it carries is read instead: a character is typed, several at once are a whole text (TXI-29: dictation,
851
+ * autofill, a paste the clipboard event did not bring), a deletion removes a digit. A composition cannot be cancelled
852
+ * and is left to the input method until it commits.
853
+ */
854
+ onBeforeInput(event) {
855
+ if (!(event.target instanceof HTMLElement) || !event.target.classList.contains('segment'))
856
+ return;
857
+ if (event.isComposing || this.composing || /Composition/.test(event.inputType))
858
+ return;
859
+ event.preventDefault();
860
+ if (this.readOnly || this.inert_)
861
+ return;
862
+ const segment = event.target;
863
+ const unit = segment.dataset.unit;
864
+ if (event.inputType.startsWith('delete')) {
865
+ this.eraseOn(segment, unit, event.inputType === 'deleteContentBackward');
866
+ return;
867
+ }
868
+ const text = event.data ?? event.dataTransfer?.getData('text/plain') ?? '';
869
+ const characters = this.characters(text);
870
+ if (characters.length === 1)
871
+ this.typeCharacter(characters[0]);
872
+ else if (characters.length > 1)
873
+ this.takeWhole(text);
874
+ }
875
+ /** TXI-45: Backspace or Delete removes the focused segment's last digit; Backspace on an empty one moves to the previous segment. */
876
+ eraseOn(segment, unit, backward) {
877
+ const row = this.row;
878
+ if (!row || this.readOnly)
879
+ return;
880
+ if (holds(this.segments, unit)) {
881
+ const result = erased(row, this.segments, unit);
882
+ this.edit(result.segments, result.typed);
883
+ }
884
+ else if (this.typedDigits)
885
+ this.typedDigits = '';
886
+ else if (backward)
887
+ this.moveFocus(segment, -1);
888
+ }
889
+ /**
890
+ * TXI-43, TXI-44, TXI-45: the keys of a segment. Left and Right Arrow move to the segment drawn on that side — the
891
+ * same in a right-to-left layout, where the row runs left to right too; Up and Down Arrow step by one, Page Up and
892
+ * Page Down by more, Home and End go to the ends of the range; Backspace and Delete remove a digit; Enter is the
893
+ * action key (TXI-3). Digits and letters arrive as `beforeinput`.
894
+ */
895
+ onSegmentKeyDown(event) {
896
+ const segment = event.target;
897
+ const row = this.row;
898
+ if (!row || !(segment instanceof HTMLElement) || !segment.classList.contains('segment'))
899
+ return;
900
+ if (event.isComposing || this.composing || event.keyCode === 229)
901
+ return;
902
+ if (event.key === 'Enter') {
903
+ event.preventDefault();
904
+ this.act(event);
905
+ return;
906
+ }
907
+ if (event.altKey || event.ctrlKey || event.metaKey)
908
+ return;
909
+ const unit = segment.dataset.unit;
910
+ const step = (by) => {
911
+ if (!this.readOnly)
912
+ this.edit(stepped(row, this.segments, unit, by, new Date()));
913
+ };
914
+ switch (event.key) {
915
+ case 'ArrowRight':
916
+ this.moveFocus(segment, 1);
917
+ break;
918
+ case 'ArrowLeft':
919
+ this.moveFocus(segment, -1);
920
+ break;
921
+ case 'ArrowUp':
922
+ step(1);
923
+ break;
924
+ case 'ArrowDown':
925
+ step(-1);
926
+ break;
927
+ case 'PageUp':
928
+ step(PAGE[unit]);
929
+ break;
930
+ case 'PageDown':
931
+ step(-PAGE[unit]);
932
+ break;
933
+ case 'Home':
934
+ case 'End':
935
+ if (!this.readOnly)
936
+ this.edit(edged(row, this.segments, unit, event.key === 'Home' ? 'first' : 'last'));
937
+ break;
938
+ case 'Backspace':
939
+ case 'Delete':
940
+ this.eraseOn(segment, unit, event.key === 'Backspace');
941
+ break;
942
+ default:
943
+ return;
944
+ }
945
+ event.preventDefault();
946
+ }
947
+ onSegmentCompositionStart() {
948
+ this.composing = true;
949
+ }
950
+ /**
951
+ * TXI-45: an input method committed text on a segment. Its digits are taken one by one, as typed (full-width ones
952
+ * too); any other text is read whole (TXI-29). What the composition drew in the segment is replaced by the field's own text.
953
+ */
954
+ onSegmentCompositionEnd(event) {
955
+ const segment = event.target instanceof HTMLElement && event.target.classList.contains('segment') ? event.target : null;
956
+ const text = event.data ?? '';
957
+ // After the event, not in it: the browser is still ending the composition — its last `input` is to come — and a
958
+ // focus moved from inside this event (a number that is complete moves on) would end the composition a second time.
959
+ setTimeout(() => {
960
+ this.composing = false;
961
+ this.paintSegments();
962
+ const characters = this.characters(text);
963
+ if (!segment || !segment.isConnected || !characters.length)
964
+ return;
965
+ if (characters.every((character) => /^[0-9]$/.test(character) || SEPARATORS.has(character))) {
966
+ let at = segment;
967
+ for (const character of characters)
968
+ at = this.typeCharacter(character, at);
969
+ }
970
+ else if (characters.length === 1)
971
+ this.typeCharacter(characters[0], segment);
972
+ else
973
+ this.takeWhole(text);
974
+ });
975
+ }
976
+ /** The browser's own `input` on a segment (a composition's) is not the field's: the value's change is (TXI-46). */
977
+ onSegmentInput(event) {
978
+ event.stopPropagation();
979
+ if (!event.isComposing)
980
+ this.paintSegments();
981
+ }
982
+ /** TXI-29: copy puts the whole row on the clipboard as drawn, whichever segment has focus. */
983
+ onCopy(event) {
984
+ const row = this.row;
985
+ if (!row)
986
+ return;
987
+ event.preventDefault();
988
+ event.clipboardData?.setData('text/plain', rowText(row, this.segments));
989
+ }
990
+ /** TXI-29: cut copies the whole row and then empties every segment, unless the field is read-only. */
991
+ onCut(event) {
992
+ this.onCopy(event);
993
+ if (this.row && fill(this.row, this.segments).held > 0)
994
+ this.edit(EMPTY_SEGMENTS);
995
+ }
996
+ /** TXI-29: pasted text is read whole, whichever segment has focus; text that reads as nothing changes nothing. */
997
+ onPaste(event) {
998
+ if (!this.row)
999
+ return;
1000
+ event.preventDefault();
1001
+ this.takeWhole(event.clipboardData?.getData('text/plain') ?? '');
1002
+ }
1003
+ /** A node of the field's own that focus may move between without committing (TXI-43): a segment, or the picker button. */
1004
+ keepsEntry(node) {
1005
+ return node instanceof Element && this.renderRoot.contains(node) && (node.classList.contains('segment') || !!node.closest('.picker'));
1006
+ }
1007
+ /** TXI-43: focus arrived on a segment or on the picker button of a date or time field. */
1008
+ onEntryFocusIn(event) {
1009
+ if (!this.row || !this.keepsEntry(event.target))
1010
+ return;
1011
+ const target = event.target;
1012
+ if (target.classList.contains('segment')) {
1013
+ this.typedDigits = '';
1014
+ this.focused = true;
1015
+ syncFocusStyle(this, this.renderRoot.querySelector('.field'));
1016
+ this.placeCaret(target);
1017
+ }
1018
+ if (!this.within) {
1019
+ this.within = true;
1020
+ this.committed = this.value;
1021
+ }
1022
+ this.pickerAsked = false;
1023
+ }
1024
+ /**
1025
+ * TXI-43: focus left a segment or the picker button. Moving between them commits nothing; leaving them for anything
1026
+ * else commits the field (TXI-2, TXI-30) — without the entry error when it leaves for the picker it asked for (TXI-33).
1027
+ */
1028
+ onEntryFocusOut(event) {
1029
+ if (!this.row || !this.keepsEntry(event.target))
1030
+ return;
1031
+ const to = event.relatedTarget;
1032
+ if (event.target.classList.contains('segment'))
1033
+ this.focused = to instanceof Element && to.classList.contains('segment') && this.renderRoot.contains(to);
1034
+ if (this.keepsEntry(to))
1035
+ return;
1036
+ this.within = false;
1037
+ this.commit({ quiet: this.pickerAsked });
1038
+ }
1039
+ // ── The native element's events ────────────────────────────────────────────────────────────────────────────
1040
+ /**
1041
+ * TXI-1, TXI-18: the user changed the value. The native `input` event is composed, so it leaves the shadow root by
1042
+ * itself — after the element has taken the new value. An edit past maxLength is cut to fit; one that changes nothing
1043
+ * then (a keystroke at the limit) is refused and heard by no one.
1044
+ */
1045
+ onInput(event) {
1046
+ const input = event.target;
1047
+ // TXI-4: the composition is the platform's; the value follows it, and nothing is written back.
1048
+ if (this.native.composingInput(event))
1049
+ return;
1050
+ if (this.maxLength > 0 && graphemes(input.value).length > this.maxLength) {
1051
+ const allowed = fit(this.held, input.value, this.maxLength);
1052
+ if (allowed.value === this.held) {
1053
+ const caret = allowed.caret;
1054
+ input.value = this.held;
1055
+ this.nativeSeen = input.value;
1056
+ this.place(input, caret);
1057
+ event.stopImmediatePropagation();
1058
+ return;
1059
+ }
1060
+ input.value = allowed.value;
1061
+ this.place(input, allowed.caret);
1062
+ }
1063
+ this.takeText(input.value);
1064
+ this.fitHeight(true);
1065
+ this.scheduleCount();
1066
+ }
1067
+ place(input, caret) {
1068
+ try {
1069
+ input.setSelectionRange(caret, caret);
1070
+ }
1071
+ catch {
1072
+ // A type without a selection API: the browser keeps the caret where it can.
1073
+ }
1074
+ }
1075
+ onFocus() {
1076
+ this.focused = true;
1077
+ this.committed = this.value;
1078
+ syncFocusStyle(this, this.renderRoot.querySelector('.field'));
1079
+ }
1080
+ /** TXI-2: focus left with a changed value — `change`, once. */
1081
+ onBlur() {
1082
+ this.focused = false;
1083
+ this.commit();
1084
+ }
1085
+ /**
1086
+ * TXI-2, TXI-30: a commit — `change` when the value differs from the one last committed, then, for a date or time
1087
+ * field left half-filled or with a value that is not available, `entryerror` (not when `quiet`: TXI-33).
1088
+ */
1089
+ commit({ quiet = false } = {}) {
1090
+ if (this.inert_)
1091
+ return;
1092
+ const began = this.readOnly || quiet ? null : this.commitEntry();
1093
+ // The form's constraint validation sees the entry error at once: the action key may submit the form next (TXI-3).
1094
+ this.syncValidity();
1095
+ if (this.value !== this.committed) {
1096
+ this.committed = this.value;
1097
+ this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
1098
+ }
1099
+ if (began) {
1100
+ this.dispatchEvent(new CustomEvent('entryerror', { bubbles: true, composed: true, detail: { reason: began.reason, text: began.text } }));
1101
+ }
1102
+ }
1103
+ /** The browser's own `change` is not the field's (TXI-2 decides when a value is committed). */
1104
+ onNativeChange(event) {
1105
+ event.stopPropagation();
1106
+ }
1107
+ /**
1108
+ * TXI-2, TXI-3: Enter in a single-line field commits the value and fires `action`; then, inside a form and unless
1109
+ * `action` was cancelled, it requests the form's submission as a native input does. Not while composing: there Enter
1110
+ * commits the composition. In a multi-line field Enter is a line break.
1111
+ */
1112
+ onKeyDown(event) {
1113
+ if (event.key !== 'Enter' || this.isMultiline || event.isComposing || this.native.composing || event.keyCode === 229)
1114
+ return;
1115
+ this.act(event);
1116
+ }
1117
+ /** TXI-3: the action key — the commit, then `action`, then the form's submission unless `action` was cancelled. */
1118
+ act(event) {
1119
+ if (this.inert_)
1120
+ return;
1121
+ this.commit();
1122
+ const action = new CustomEvent('action', { bubbles: true, composed: true, cancelable: true, detail: { value: this.value } });
1123
+ const proceed = this.dispatchEvent(action);
1124
+ // Its own form, or the form of the element composed around it (src/primitives/default-button.ts, `formOf`).
1125
+ const form = proceed ? formOf(this, this.form) : null;
1126
+ if (form) {
1127
+ event.preventDefault();
1128
+ pressDefaultButton(form);
1129
+ }
1130
+ }
1131
+ /**
1132
+ * TXI-33: the picker button asks the product for a picker and changes nothing itself: no value, no focus, nothing
1133
+ * presented, nothing committed — the value it carries is empty while the row is half-filled or not available, and no
1134
+ * entry error is raised for that, because the picker is about to give a whole value.
1135
+ */
1136
+ onPickerClick() {
1137
+ const kind = this.dateKind;
1138
+ if (!kind || this.inert_ || this.readOnly)
1139
+ return;
1140
+ this.pickerAsked = true;
1141
+ const detail = { value: this.value, type: kind, min: this.limit('min'), max: this.limit('max') };
1142
+ this.dispatchEvent(new CustomEvent('pickerrequest', { bubbles: true, composed: true, detail }));
1143
+ }
1144
+ /**
1145
+ * TXI-33: a press on the picker button is already the request, as far as the entry error goes: where a press on a
1146
+ * button moves focus to nothing (Safari), focus leaves the segments before the click arrives.
1147
+ */
1148
+ onPickerPress() {
1149
+ if (this.dateKind && !this.inert_ && !this.readOnly)
1150
+ this.pickerAsked = true;
1151
+ }
1152
+ /** TXI-8, TXI-43: what a press on the field focuses: the input; in a date or time field the first empty segment, or the last while none is empty. */
1153
+ get entryTarget() {
1154
+ const row = this.row;
1155
+ if (!row)
1156
+ return this.input;
1157
+ const all = this.segmentElements;
1158
+ const empty = row.units.findIndex((unit) => !holds(this.segments, unit));
1159
+ return all[empty < 0 ? all.length - 1 : empty] ?? null;
1160
+ }
1161
+ /**
1162
+ * TXI-8: a press anywhere on the box — its padding, a floating label, the prefix, the suffix, a decorative icon, the
1163
+ * text between two segments — focuses the input (TXI-43: a segment). An
1164
+ * interactive element in a slot, a segment, the picker button and the resize grip keep their own press.
1165
+ */
1166
+ onFieldMouseDown(event) {
1167
+ const input = this.entryTarget;
1168
+ if (!input || this.inert_ || event.button !== 0)
1169
+ return;
1170
+ const path = event.composedPath();
1171
+ if (path.includes(input))
1172
+ return;
1173
+ for (const node of path) {
1174
+ if (node === this.renderRoot)
1175
+ break;
1176
+ if (node instanceof HTMLElement && node.matches('a[href], button, input, select, textarea, [tabindex], [contenteditable]'))
1177
+ return;
1178
+ if (node instanceof HTMLElement && node.shadowRoot?.delegatesFocus)
1179
+ return;
1180
+ }
1181
+ event.preventDefault();
1182
+ input.focus();
1183
+ }
1184
+ onSlotChange(event) {
1185
+ const slot = event.target;
1186
+ const filled = slot.assignedNodes({ flatten: true }).some((node) => node.nodeType === Node.ELEMENT_NODE || node.textContent?.trim());
1187
+ if (slot.name === 'leading-icon')
1188
+ this.hasLeading = filled;
1189
+ else if (slot.name === 'entries')
1190
+ this.hasEntries = filled;
1191
+ else
1192
+ this.hasTrailing = filled;
1193
+ }
1194
+ // ── The count and its announcement (TXI-19) ───────────────────────────────────────────────────────────────────────
1195
+ /** Something to be read once, politely, by assistive technology (a live region drawn nowhere). */
1196
+ announce(text) {
1197
+ const region = this.renderRoot.querySelector('.announcer');
1198
+ if (!region || !text)
1199
+ return;
1200
+ region.textContent = '';
1201
+ // A new text node in a cleared region is announced even when it repeats the last one.
1202
+ requestAnimationFrame(() => (region.textContent = text));
1203
+ }
1204
+ /** TXI-19: the count is announced once typing has paused for a second, never on every keystroke. */
1205
+ scheduleCount() {
1206
+ if (!this.counter)
1207
+ return;
1208
+ clearTimeout(this.countTimer);
1209
+ this.countTimer = setTimeout(() => this.announce(this.countText), 1000);
1210
+ }
1211
+ get count() {
1212
+ return graphemes(this.shownValue).length;
1213
+ }
1214
+ /**
1215
+ * TXI-19: the count the input keeps, as text — the user-perceived characters of the value, then a slash and
1216
+ * `maxLength` while there is one ("12/40") — and empty while `counter` is not set. Read-only, and new with every
1217
+ * change of the value or of `maxLength`: a product that frames the input by hand gives it to its Field's
1218
+ * `countText` in its own `input` listener, and `<tanrei-text-field>` does so by itself.
1219
+ */
1220
+ get countText() {
1221
+ if (!this.counter)
1222
+ return '';
1223
+ return this.maxLength > 0 && !this.dateKind ? `${this.count}/${this.maxLength}` : `${this.count}`;
1224
+ }
1225
+ /** The input is in the error condition: its own `error`, its Field's (FLD-8), or a date or time input's entry error (TXI-11, TXI-30). */
1226
+ get inError() {
1227
+ return this.error || this.frame.invalid || !!this.entryError;
1228
+ }
1229
+ // ── The height of a multi-line field (TXI-17, TXI-37 … TXI-41) ───────────────────────────────────────────────
1230
+ clampLines(lines) {
1231
+ return Math.min(Math.max(lines, this.minLines), this.maxLines || Number.POSITIVE_INFINITY);
1232
+ }
1233
+ /** One line of the input's text style, in px (a duration or a length token is an expression: the element resolves it). */
1234
+ lineOf(input) {
1235
+ return Number.parseFloat(getComputedStyle(input).lineHeight) || 1;
1236
+ }
1237
+ /**
1238
+ * The lines the input shows now — during a motion, the height then shown (TXI-38): the room it takes in the
1239
+ * container, which is its box and, while a change of height is moving, what its bottom margin still adds or takes back.
1240
+ */
1241
+ shownLines(input) {
1242
+ const style = getComputedStyle(input);
1243
+ // (TXI-58: not the room of a sideways scrollbar, which is no line.)
1244
+ return (Number.parseFloat(style.height) - this.bar + (Number.parseFloat(style.marginBottom) || 0)) / this.lineOf(input) || 0;
1245
+ }
1246
+ /** The lines the text needs in the width the input has — a line the text wraps onto counts as one. */
1247
+ textLines(input) {
1248
+ const { blockSize, minBlockSize } = input.style;
1249
+ input.style.blockSize = '0px';
1250
+ input.style.minBlockSize = '0px';
1251
+ // TXI-53: the room a right-to-left code field keeps after its last line for the grip is scrolling room, not a line.
1252
+ const lines = (input.scrollHeight - (Number.parseFloat(getComputedStyle(input).paddingBottom) || 0)) / this.lineOf(input);
1253
+ input.style.blockSize = blockSize;
1254
+ input.style.minBlockSize = minBlockSize;
1255
+ return wholeLines(lines);
1256
+ }
1257
+ /**
1258
+ * TXI-38: the input shows `target` lines. With `animate` — a change that follows the value, the grip's keys or its
1259
+ * activation — the height moves there from the one shown over motion.resize-* (the styles; at once where motion is
1260
+ * reduced), continuing from wherever a running change had brought it; otherwise it changes at once.
1261
+ *
1262
+ * TXI-51: what moves is the room the input takes, never its text. The native element is `target` lines high at once —
1263
+ * a box as tall as its text has nothing to scroll, so the browser cannot scroll the first line away to show the caret
1264
+ * on a line the box does not hold yet (which is what shook) — and `--_lag`, the lines the room shown still differs by,
1265
+ * goes to 0 over the motion: as a bottom margin that takes the new lines back or still holds the removed ones, and as
1266
+ * a clip that uncovers a new line from its top as the container's bottom edge passes it.
1267
+ */
1268
+ showLines(input, shown, target, animate) {
1269
+ input.removeAttribute('data-resizing');
1270
+ input.style.setProperty('--_rows', String(target));
1271
+ if (animate && this.sized === input && Math.abs(shown - target) > 0.01) {
1272
+ // The room shown before the change, with the new box: the styles' starting point, drawn without a transition…
1273
+ input.style.setProperty('--_lag', String(shown - target));
1274
+ input.setAttribute('data-resizing', 'from');
1275
+ void input.offsetHeight;
1276
+ // …and from there to no difference, over the motion.
1277
+ input.setAttribute('data-resizing', '');
1278
+ }
1279
+ input.style.removeProperty('--_lag');
1280
+ this.sized = input;
1281
+ this.lines = target;
1282
+ // TXI-41: the grip's value is the number of lines the input shows.
1283
+ this.renderRoot.querySelector('.grip')?.setAttribute('aria-valuenow', String(Math.round(target)));
1284
+ }
1285
+ /**
1286
+ * TXI-17, TXI-37: the height `resize` names. Auto: exactly the lines of the text, between minRows and maxRows, and it
1287
+ * scrolls only beyond maxRows. Manual: the lines the person gave it, from minRows. Fixed: minRows.
1288
+ */
1289
+ fitHeight(animate) {
1290
+ for (const _ of this.fitting(animate))
1291
+ void _;
1292
+ }
1293
+ /**
1294
+ * @internal The steps of `fitHeight()`, each ending where reading turns to writing or writing to reading: run
1295
+ * through, they fit this field; taken a step at a time for many fields (`fitTogether`), every field reads before any
1296
+ * writes, and the fields of a page cost three layouts between them where each cost five.
1297
+ */
1298
+ *fitting(animate) {
1299
+ const input = this.textarea;
1300
+ if (!input)
1301
+ return;
1302
+ const shown = this.shownLines(input);
1303
+ yield; // ── written from here
1304
+ input.removeAttribute('data-resizing');
1305
+ const mode = this.resizeMode;
1306
+ let target = this.minLines;
1307
+ let overflows = false;
1308
+ if (mode === 'auto') {
1309
+ // The lines the text needs (`textLines`), its two halves apart.
1310
+ const { blockSize, minBlockSize } = input.style;
1311
+ input.style.blockSize = '0px';
1312
+ input.style.minBlockSize = '0px';
1313
+ yield; // ── read from here
1314
+ const lines = input.scrollHeight / this.lineOf(input);
1315
+ yield; // ── written from here
1316
+ input.style.blockSize = blockSize;
1317
+ input.style.minBlockSize = minBlockSize;
1318
+ const needed = wholeLines(lines);
1319
+ target = this.clampLines(needed);
1320
+ overflows = needed > target + 0.01;
1321
+ }
1322
+ else if (mode === 'manual')
1323
+ target = this.clampLines(this.manualLines ?? this.minLines);
1324
+ input.toggleAttribute('data-overflows', overflows);
1325
+ this.showLines(input, shown, target, animate);
1326
+ yield; // ── read from here
1327
+ this.lastBox = { width: input.clientWidth, line: this.lineOf(input) };
1328
+ // TXI-58: where the browser draws a sideways scrollbar that takes room (a classic one; an overlay one takes none),
1329
+ // an auto-resized field whose lines do not wrap is taller by that room, so that no line stands under the scrollbar
1330
+ // and none is scrolled up or down for its sake. The room is what the input's box holds beyond its content and
1331
+ // padding; it is written once more only where it changed. Every other field has none, and reads nothing for it.
1332
+ if (!this.unwrapped && !this.bar)
1333
+ return;
1334
+ const bar = this.unwrapped && mode === 'auto' ? Math.max(0, input.offsetHeight - input.clientHeight) : 0;
1335
+ if (bar === this.bar)
1336
+ return;
1337
+ yield; // ── written from here
1338
+ this.bar = bar;
1339
+ if (bar)
1340
+ input.style.setProperty('--_bar', `${bar}px`);
1341
+ else
1342
+ input.style.removeProperty('--_bar');
1343
+ }
1344
+ /** TXI-39, TXI-41: the person gives a manually resized field `lines` lines, within minRows and maxRows. */
1345
+ resizeTo(lines, animate) {
1346
+ const input = this.textarea;
1347
+ if (!input)
1348
+ return;
1349
+ const shown = this.shownLines(input);
1350
+ this.manualLines = this.clampLines(lines);
1351
+ this.showLines(input, shown, this.manualLines, animate);
1352
+ }
1353
+ /**
1354
+ * TXI-41: the grip activated without a drag — the input becomes as tall as its text needs, within minRows and
1355
+ * maxRows, and returns to minRows when it is already that tall.
1356
+ */
1357
+ fitToText() {
1358
+ const input = this.textarea;
1359
+ if (!input)
1360
+ return;
1361
+ const shown = this.shownLines(input);
1362
+ input.removeAttribute('data-resizing');
1363
+ const fits = this.clampLines(this.textLines(input));
1364
+ this.manualLines = Math.abs(this.lines - fits) < 0.01 ? this.minLines : fits;
1365
+ this.showLines(input, shown, this.manualLines, true);
1366
+ }
1367
+ /**
1368
+ * TXI-39: the field's own width, as the person gives it — written as the host's inline size, never narrower than its
1369
+ * inline paddings, its icons and sys.target.touch, and no wider than its layout allows (its own max-inline-size, or
1370
+ * its containing block where it has none).
1371
+ */
1372
+ resizeWidth(width) {
1373
+ const input = this.textarea;
1374
+ if (!input)
1375
+ return;
1376
+ const touch = this.renderRoot.querySelector('.touch-probe')?.getBoundingClientRect().width ?? 0;
1377
+ const least = this.getBoundingClientRect().width - input.getBoundingClientRect().width + touch;
1378
+ if (!this.manualWidth) {
1379
+ this.manualWidth = { inlineSize: this.style.inlineSize, maxInlineSize: this.style.maxInlineSize };
1380
+ if (getComputedStyle(this).maxInlineSize === 'none')
1381
+ this.style.maxInlineSize = '100%';
1382
+ }
1383
+ this.style.inlineSize = `${Math.max(width, least)}px`;
1384
+ }
1385
+ /** TXI-39: the size the person gave the field is kept until resize, resizeAxis, minRows or maxRows changes. */
1386
+ releaseSize() {
1387
+ this.manualLines = null;
1388
+ if (!this.manualWidth)
1389
+ return;
1390
+ this.style.inlineSize = this.manualWidth.inlineSize;
1391
+ this.style.maxInlineSize = this.manualWidth.maxInlineSize;
1392
+ this.manualWidth = null;
1393
+ }
1394
+ /**
1395
+ * TXI-39, TXI-40: a press that begins on the grip's hit area belongs to the grip — it does not place the caret,
1396
+ * select text or take focus from the input — and a drag follows the pointer without motion.
1397
+ */
1398
+ onGripPointerDown(event) {
1399
+ const input = this.textarea;
1400
+ if (!input || event.button !== 0)
1401
+ return;
1402
+ event.preventDefault();
1403
+ const grip = event.currentTarget;
1404
+ grip.setPointerCapture?.(event.pointerId);
1405
+ this.drag = {
1406
+ id: event.pointerId,
1407
+ x: event.clientX,
1408
+ y: event.clientY,
1409
+ lines: this.shownLines(input),
1410
+ width: this.getBoundingClientRect().width,
1411
+ line: this.lineOf(input),
1412
+ rtl: getComputedStyle(this).direction === 'rtl',
1413
+ moved: false,
1414
+ };
1415
+ }
1416
+ onGripPointerMove(event) {
1417
+ const drag = this.drag;
1418
+ if (!drag || event.pointerId !== drag.id)
1419
+ return;
1420
+ const [dx, dy] = [event.clientX - drag.x, event.clientY - drag.y];
1421
+ if (!drag.moved && Math.hypot(dx, dy) <= DRAG_SLOP)
1422
+ return;
1423
+ drag.moved = true;
1424
+ this.resizeTo(drag.lines + dy / drag.line, false);
1425
+ // TXI-24: the end edge follows the pointer — to the left in a right-to-left layout.
1426
+ if (this.axis === 'both')
1427
+ this.resizeWidth(drag.width + (drag.rtl ? -dx : dx));
1428
+ }
1429
+ onGripPointerUp(event) {
1430
+ const drag = this.drag;
1431
+ if (!drag || event.pointerId !== drag.id)
1432
+ return;
1433
+ this.drag = null;
1434
+ // TXI-41: a click or a tap that ends where it began fits the height to the text.
1435
+ if (!drag.moved)
1436
+ this.fitToText();
1437
+ }
1438
+ onGripPointerCancel() {
1439
+ this.drag = null;
1440
+ }
1441
+ onGripMouseDown(event) {
1442
+ event.preventDefault();
1443
+ }
1444
+ /** TXI-41: an activation that came with no pointer (a click assistive technology makes) fits the height to the text too. */
1445
+ onGripClick(event) {
1446
+ if (event.detail === 0)
1447
+ this.fitToText();
1448
+ }
1449
+ /**
1450
+ * TXI-41: Down Arrow makes the input one line taller and Up Arrow one line shorter, Home returns it to minRows and
1451
+ * End takes it to maxRows (without one, to the height that shows every line); where the field resizes both ways the
1452
+ * horizontal arrow that points to its end edge widens it by one line height and the other narrows it; Enter and
1453
+ * Space fit the height to the text. Each change moves as TXI-38 says.
1454
+ */
1455
+ onGripKeyDown(event) {
1456
+ const input = this.textarea;
1457
+ if (!input || event.altKey || event.ctrlKey || event.metaKey)
1458
+ return;
1459
+ const rtl = getComputedStyle(this).direction === 'rtl';
1460
+ const widen = (by) => {
1461
+ if (this.axis === 'both')
1462
+ this.resizeWidth(this.getBoundingClientRect().width + by * this.lineOf(input));
1463
+ };
1464
+ switch (event.key) {
1465
+ case 'ArrowDown':
1466
+ this.resizeTo(Math.round(this.lines) + 1, true);
1467
+ break;
1468
+ case 'ArrowUp':
1469
+ this.resizeTo(Math.round(this.lines) - 1, true);
1470
+ break;
1471
+ case 'Home':
1472
+ this.resizeTo(this.minLines, true);
1473
+ break;
1474
+ case 'End': {
1475
+ const shown = this.shownLines(input);
1476
+ input.removeAttribute('data-resizing');
1477
+ this.manualLines = this.maxLines || this.clampLines(this.textLines(input));
1478
+ this.showLines(input, shown, this.manualLines, true);
1479
+ break;
1480
+ }
1481
+ case 'ArrowRight':
1482
+ if (this.axis !== 'both')
1483
+ return;
1484
+ widen(rtl ? -1 : 1);
1485
+ break;
1486
+ case 'ArrowLeft':
1487
+ if (this.axis !== 'both')
1488
+ return;
1489
+ widen(rtl ? 1 : -1);
1490
+ break;
1491
+ case 'Enter':
1492
+ case ' ':
1493
+ this.fitToText();
1494
+ break;
1495
+ default:
1496
+ return;
1497
+ }
1498
+ event.preventDefault();
1499
+ }
1500
+ onGripFocus(event) {
1501
+ syncFocusStyle(this, event.currentTarget);
1502
+ }
1503
+ onResizeEnd(event) {
1504
+ const input = event.currentTarget;
1505
+ if (event.target === input && /^margin-(block-end|bottom)$/.test(event.propertyName))
1506
+ input.removeAttribute('data-resizing');
1507
+ }
1508
+ /**
1509
+ * TXI-37, TXI-38: the height follows a changed width and enlarged text too — at once, without the motion. The
1510
+ * textarea's own box says both: its width, and (its height being a number of lines) the line of its text style.
1511
+ */
1512
+ observeSize() {
1513
+ const input = this.textarea;
1514
+ if (input === this.observedInput)
1515
+ return;
1516
+ this.sizeObserver ??= typeof ResizeObserver === 'undefined' ? undefined : new ResizeObserver(() => this.sizeChanged());
1517
+ this.sizeObserver?.disconnect();
1518
+ this.observedInput = input;
1519
+ if (input)
1520
+ this.sizeObserver?.observe(input);
1521
+ }
1522
+ sizeChanged() {
1523
+ const input = this.textarea;
1524
+ if (!input || this.drag)
1525
+ return;
1526
+ const [width, line] = [input.clientWidth, this.lineOf(input)];
1527
+ if (width === this.lastBox.width && line === this.lastBox.line)
1528
+ return;
1529
+ this.fitHeight(false);
1530
+ }
1531
+ /**
1532
+ * The form's view of the input: a missing value while its Field says it is required; a date or time field's entry error as badInput
1533
+ * (a half-filled row), rangeUnderflow or rangeOverflow (a value before min or after max) or a custom error (a listed
1534
+ * date) while it lasts (TXI-30). A requirement never validates beyond that (TXI-23).
1535
+ */
1536
+ syncValidity() {
1537
+ const input = this.input;
1538
+ const entry = this.entryError;
1539
+ const anchor = input ?? this.renderRoot.querySelector('.segment') ?? undefined;
1540
+ if (entry) {
1541
+ const flag = entry.reason === 'invalid' ? 'badInput' : entry.side === 'under' ? 'rangeUnderflow' : entry.side === 'listed' ? 'customError' : 'rangeOverflow';
1542
+ this.says.validity({ [flag]: true }, this.refusalText || this.frame.description() || entry.reason, anchor);
1543
+ return;
1544
+ }
1545
+ if (this.row) {
1546
+ if (this.required_ && !this.value && !this.inert_)
1547
+ this.says.validity({ valueMissing: true }, this.missingMessage(), anchor);
1548
+ else
1549
+ this.says.validity();
1550
+ return;
1551
+ }
1552
+ if (!input || input.validity.valid)
1553
+ this.says.validity();
1554
+ else
1555
+ this.says.validity({ valueMissing: input.validity.valueMissing }, input.validationMessage, input);
1556
+ }
1557
+ /** Watches the two icon boxes: an element the product slotted there keeps its own size (TXI-22). */
1558
+ observeIcons() {
1559
+ if (typeof ResizeObserver === 'undefined')
1560
+ return;
1561
+ const boxes = Array.from(this.renderRoot.querySelectorAll('.icon.leading, .icon.trailing'));
1562
+ if (boxes.length === this.observedIcons.length && boxes.every((box, i) => box === this.observedIcons[i]))
1563
+ return;
1564
+ this.iconObserver ??= new ResizeObserver((entries) => this.measureIcons(entries));
1565
+ this.iconObserver.disconnect();
1566
+ for (const box of boxes)
1567
+ this.iconObserver.observe(box);
1568
+ this.observedIcons = boxes;
1569
+ }
1570
+ /**
1571
+ * TXI-13, TXI-62: the text starts after the leading box and ends before the trailing one as they are laid out; the
1572
+ * label, its copies and the Field's supporting row are placed by a sum of lengths, which takes the icon's size for
1573
+ * the box's. While a box is wider than that — the product's icon button — its measured length is written into the
1574
+ * sum (`--_lead`, `--_trail`) and said to the Field; a glyph, an icon wide, writes nothing and the field is laid out
1575
+ * from its tokens alone.
1576
+ */
1577
+ measureIcons(entries) {
1578
+ const field = this.renderRoot.querySelector('.field');
1579
+ if (!field)
1580
+ return;
1581
+ let changed = false;
1582
+ for (const entry of entries) {
1583
+ const box = entry.target;
1584
+ const side = box.classList.contains('leading') ? 'lead' : 'trail';
1585
+ const size = entry.borderBoxSize?.[0]?.inlineSize ?? entry.contentRect.width;
1586
+ // The box is never narrower than an icon (its least length); half a pixel is the rounding of a layout.
1587
+ const wider = size > 0 && size - Number.parseFloat(getComputedStyle(box).minInlineSize) > 0.5;
1588
+ const length = wider ? `${Math.round(size * 100) / 100}px` : '';
1589
+ if (this.iconBoxes[side] === length)
1590
+ continue;
1591
+ this.iconBoxes[side] = length;
1592
+ if (length)
1593
+ field.style.setProperty(`--_${side}`, length);
1594
+ else
1595
+ field.style.removeProperty(`--_${side}`);
1596
+ changed = true;
1597
+ }
1598
+ // TXI-62: what the input says to its Field has changed — it is said again after the update.
1599
+ if (changed)
1600
+ this.requestUpdate();
1601
+ }
1602
+ /** Returns whether copies are watched from now on that were not before: the observer reports each of them once, after the next layout. */
1603
+ observeLabel() {
1604
+ const copies = Array.from(this.renderRoot.querySelectorAll('.measure'));
1605
+ if (copies.length === this.observedCopies.length && copies.every((copy, i) => copy === this.observedCopies[i]))
1606
+ return false;
1607
+ this.labelObserver ??= new ResizeObserver(() => this.measureLabel());
1608
+ this.labelObserver.disconnect();
1609
+ for (const copy of copies)
1610
+ this.labelObserver.observe(copy);
1611
+ const had = this.observedCopies.length > 0;
1612
+ this.observedCopies = copies;
1613
+ // No copy any more (the label left, or stands above the container now): what the last measure wrote is taken back.
1614
+ if (!copies.length && had)
1615
+ this.measureLabel();
1616
+ return copies.length > 0;
1617
+ }
1618
+ /**
1619
+ * TXI-13: how many lines a floating label takes resting and floated, in the width it is given in each position, and
1620
+ * the width of the widest floated line. The copies are laid out as the drawn label is in each position and never
1621
+ * drawn. While both take one line nothing is set and the field is laid out as it always was; once either wraps, the
1622
+ * field marks it (`data-label-wraps`) and the styles give the lines their room: a taller container, a filled field's
1623
+ * taller band, an outlined field's room above its container, and a gap as wide as the widest line. A stacked label
1624
+ * stands above the container in the flow and wraps there by itself (TXI-25).
1625
+ */
1626
+ measureLabel() {
1627
+ const field = this.renderRoot.querySelector('.field');
1628
+ if (!field)
1629
+ return;
1630
+ const resting = labelLines(this.renderRoot.querySelector('.measure-resting'));
1631
+ const floated = labelLines(this.renderRoot.querySelector('.measure-floated'));
1632
+ const wraps = resting.count > 1 || floated.count > 1;
1633
+ field.toggleAttribute('data-label-wraps', wraps);
1634
+ if (wraps) {
1635
+ field.style.setProperty('--_rest-lines', String(resting.count));
1636
+ field.style.setProperty('--_float-lines', String(floated.count));
1637
+ field.style.setProperty('--_float-widest', `${floated.widest}px`);
1638
+ }
1639
+ else {
1640
+ for (const name of ['--_rest-lines', '--_float-lines', '--_float-widest'])
1641
+ field.style.removeProperty(name);
1642
+ }
1643
+ }
1644
+ connectedCallback() {
1645
+ super.connectedCallback();
1646
+ if (this.hasUpdated) {
1647
+ this.observeLabel();
1648
+ this.observeSize();
1649
+ this.observeIcons();
1650
+ }
1651
+ }
1652
+ disconnectedCallback() {
1653
+ super.disconnectedCallback();
1654
+ clearTimeout(this.countTimer);
1655
+ this.labelObserver?.disconnect();
1656
+ this.observedCopies = [];
1657
+ this.iconObserver?.disconnect();
1658
+ this.observedIcons = [];
1659
+ this.sizeObserver?.disconnect();
1660
+ this.observedInput = null;
1661
+ this.drag = null;
1662
+ }
1663
+ willUpdate(changed) {
1664
+ const kind = this.dateKind;
1665
+ if (changed.has('locale') && this.locale.trim() && !supportedLocale(this.locale.trim())) {
1666
+ report(this, 'TXI-28', `locale "${this.locale}" is not a BCP 47 tag this browser knows; it uses "${FALLBACK_LOCALE}"`);
1667
+ }
1668
+ // TXI-31: a value, min or max that is not the ISO form of a date or time field's type is treated as empty.
1669
+ if (kind && (changed.has('value') || changed.has('type')) && this.value && !isoValue(kind, this.value)) {
1670
+ report(this, 'TXI-31', `value "${this.value}" is not the ISO 8601 form of a ${kind}; it is treated as empty`);
1671
+ this.value = '';
1672
+ this.userValue = undefined;
1673
+ }
1674
+ const byProduct = changed.has('value') && this.value !== this.userValue;
1675
+ if (byProduct) {
1676
+ // TXI-2: what the product sets while the field is not being edited is what a later commit compares with.
1677
+ if (!this.focused)
1678
+ this.committed = this.value;
1679
+ // TXI-31: a date or time field fills every segment from the value, and ends any entry error. (A value set to what
1680
+ // the value already is never arrives here, so a half-filled row an echoing product sees stays: TXI-46.)
1681
+ this.showValue();
1682
+ }
1683
+ else if (kind && (changed.has('type') || changed.has('locale'))) {
1684
+ // A new kind or locale draws the value anew; without a value, a new kind starts empty and a new locale keeps what
1685
+ // the date's segments hold (an hour is of one clock: it does not carry over).
1686
+ const row = this.row;
1687
+ if (this.value)
1688
+ this.segments = segmentsOf(row, this.value);
1689
+ else if (changed.has('type'))
1690
+ this.segments = EMPTY_SEGMENTS;
1691
+ else
1692
+ this.segments = { ...this.segments, hour: null, period: null };
1693
+ this.typedDigits = '';
1694
+ }
1695
+ if (changed.has('min') || changed.has('max') || changed.has('type')) {
1696
+ for (const which of ['min', 'max']) {
1697
+ if (kind && this[which] && !isoValue(kind, this[which]))
1698
+ report(this, 'TXI-31', `${which} "${this[which]}" is not the ISO 8601 form of a ${kind}; it is treated as empty`);
1699
+ }
1700
+ const [min, max] = [this.limit('min'), this.limit('max')];
1701
+ if (min && max && min > max)
1702
+ report(this, 'TXI-31', `min "${min}" is later than max "${max}"`);
1703
+ }
1704
+ if (changed.has('disabledDates') || changed.has('type')) {
1705
+ for (const entry of kind && kind !== 'time' ? (this.disabledDates ?? []) : []) {
1706
+ if (typeof entry !== 'string' || !isoValue('date', entry))
1707
+ report(this, 'TXI-31', `the entry "${String(entry)}" of disabledDates is not an ISO 8601 calendar date; it is ignored`);
1708
+ }
1709
+ }
1710
+ // TXI-39: the size the person gave the field lasts until one of these changes.
1711
+ if (this.hasUpdated && (changed.has('resize') || changed.has('resizeAxis') || changed.has('minRows') || changed.has('maxRows') || changed.has('multiline') || changed.has('type')))
1712
+ this.releaseSize();
1713
+ }
1714
+ updated(changed) {
1715
+ // TXI-4: never written into a composition; a value the product sets meanwhile waits for its end.
1716
+ const written = this.native.show();
1717
+ // What the native element holds now is what the element gave it, or took from it (see `value`).
1718
+ this.nativeInput = this.input;
1719
+ this.nativeSeen = this.nativeInput?.value;
1720
+ const input = this.textarea;
1721
+ if (input) {
1722
+ const laidOut = ['multiline', 'type', 'noWrap', 'minRows', 'maxRows', 'resize', 'resizeAxis', 'size', 'variant'];
1723
+ // TXI-38: a height that follows the value moves; the first one, and one that follows anything else, does not.
1724
+ if (input !== this.sized || laidOut.some((name) => changed.has(name)))
1725
+ fitTogether(this);
1726
+ else if (written)
1727
+ this.fitHeight(true);
1728
+ }
1729
+ else {
1730
+ this.sized = null;
1731
+ this.bar = 0;
1732
+ }
1733
+ this.observeSize();
1734
+ // TXI-41: a grip drawn anew says the lines the input shows.
1735
+ const grip = this.renderRoot.querySelector('.grip');
1736
+ if (grip && !grip.hasAttribute('aria-valuenow'))
1737
+ grip.setAttribute('aria-valuenow', String(Math.round(this.lines || this.minLines)));
1738
+ if (!this.drawn && input) {
1739
+ this.drawn = true;
1740
+ // The text may be laid out again when its face arrives: the height follows, without motion. Only a field that
1741
+ // has a height to fit asks (asking has the browser bring the page's style up to date: `facesArrived`).
1742
+ void facesArrived()?.then(() => this.isConnected && fitTogether(this));
1743
+ }
1744
+ // TXI-42: the segments' text is the field's to write.
1745
+ this.paintSegments();
1746
+ // TXI-13: the copies of the label are watched for their lines; a new text may break differently in the same box.
1747
+ const newlyWatched = this.observeLabel();
1748
+ // TXI-22: the icon boxes are watched for an element wider than an icon.
1749
+ this.observeIcons();
1750
+ // A copy that is watched from this update on is measured when the observer first reports it — after the layout of
1751
+ // the frame it is first drawn in, with every other field's — and not here, in this field's own turn, where the
1752
+ // read would have the page laid out once for each field.
1753
+ const labelChanged = changed.has('label') || changed.has('labelHidden') || changed.has('variant') || this.frameChanged;
1754
+ this.frameChanged = false;
1755
+ if (labelChanged && !newlyWatched)
1756
+ this.measureLabel();
1757
+ // TXI-5: a disabled input is left out of the submission — its own attribute, a fieldset's, or its Field's.
1758
+ this.says.value(this.inert_ ? null : this.value, this.value);
1759
+ this.syncValidity();
1760
+ // TXI-32: the picker button says it opens a dialog, on the native button that carries its semantics.
1761
+ const pickerButton = this.renderRoot.querySelector('.picker-button');
1762
+ if (pickerButton) {
1763
+ void pickerButton.updateComplete.then(() => {
1764
+ const native = pickerButton.shadowRoot?.querySelector('button');
1765
+ if (native)
1766
+ hostAria(native, { 'aria-haspopup': 'dialog' });
1767
+ });
1768
+ }
1769
+ this.reportMisuse(changed);
1770
+ }
1771
+ /** What a debug build reports (TXI-9, TXI-17, TXI-23, TXI-28, TXI-32, TXI-41, TXI-57). */
1772
+ reportMisuse(changed) {
1773
+ const kind = this.dateKind;
1774
+ const any = (...names) => names.some((name) => changed.has(name));
1775
+ // TXI-23: an input no Field names, with no label of its own, still renders. (A Field with an empty label says so itself: FLD-10.)
1776
+ if ((changed.has('label') || !this.hasUpdated) && !this.label.trim() && !this.frame.state) {
1777
+ report(this, 'TXI-23', 'label is empty and no field frames it, so the text input has no accessible name; put it in a field with a label, or give it a label');
1778
+ }
1779
+ if (changed.has('type') && !(this.type in TYPES))
1780
+ report(this, 'TXI-9', `type "${this.type}" is not a type of the text input; it behaves as "text"`);
1781
+ if (any('type', 'multiline') && this.multiline && (this.type === 'password' || kind)) {
1782
+ report(this, 'TXI-17', `a ${this.type} field stays single-line; multiline is ignored`);
1783
+ }
1784
+ // TXI-57: wrap false is read by a multi-line code field alone — prose always wraps, a single line scrolls in its line.
1785
+ if (any('noWrap', 'type', 'multiline') && this.noWrap && !this.unwrapped) {
1786
+ report(this, 'TXI-57', 'no-wrap is ignored: it is read only by a multi-line code field (type="code" with multiline)');
1787
+ }
1788
+ if (changed.has('resize') && !RESIZES.includes(this.resize))
1789
+ report(this, 'TXI-17', `resize "${this.resize}" is not a way the text input is resized; it behaves as "auto"`);
1790
+ if (changed.has('resizeAxis') && !RESIZE_AXES.includes(this.resizeAxis))
1791
+ report(this, 'TXI-17', `resizeAxis "${this.resizeAxis}" is not an axis the text input resizes; it behaves as "vertical"`);
1792
+ // TXI-41, TXI-52: a grip nobody named is drawn and works; the developer is told.
1793
+ if (this.gripShown && !this.gripName)
1794
+ this.words.missing('resizeLabel', { id: 'TXI-41', effect: 'the resize grip is drawn and works, and has no accessible name' });
1795
+ // TXI-28: what a date, time or date-time field ignores, because every empty segment shows its own placeholder and the row is not free text.
1796
+ if (kind && any('type', 'placeholder', 'maxLength', 'prefixText', 'suffixText')) {
1797
+ const ignored = { placeholder: !!this.placeholder, maxLength: this.maxLength > 0, prefixText: !!this.prefixText, suffixText: !!this.suffixText };
1798
+ for (const [name, set] of Object.entries(ignored))
1799
+ if (set)
1800
+ report(this, 'TXI-28', `${name} is ignored by a ${kind} field: its segments each show their own placeholder, and the row is not free text`);
1801
+ }
1802
+ if (any('type', 'picker') && this.picker && !kind) {
1803
+ report(this, 'TXI-32', `picker is ignored: the type "${this.type}" is not date, time or date-time`);
1804
+ }
1805
+ if (any('picker', 'pickerLabel', 'type', 'readOnly') && this.pickerShown && !this.pickerLabel.trim()) {
1806
+ report(this, 'TXI-32', 'pickerLabel is empty, so the picker button has no accessible name; give it one ("Choose date")');
1807
+ }
1808
+ }
1809
+ /** TXI-32: a date, time or date-time field with `picker`, not read-only, draws the picker button. */
1810
+ get pickerShown() {
1811
+ return !!this.dateKind && this.picker && !this.readOnly;
1812
+ }
1813
+ /** TXI-32: the Button size with the field's size name, or Button's default for a size Button does not have. */
1814
+ get pickerSize() {
1815
+ if (BUTTON_SIZES.has(this.size))
1816
+ return this.size;
1817
+ const own = /^[a-z0-9][a-z0-9-]*$/.test(this.size) && getComputedStyle(this).getPropertyValue(`--tanrei-comp-button-container-height-${this.size}`).trim();
1818
+ return own ? this.size : 'medium';
1819
+ }
1820
+ renderPicker() {
1821
+ if (!this.pickerShown)
1822
+ return nothing;
1823
+ // TXI-32: calendar_month for a date and a date-time, schedule for a time.
1824
+ const glyph = this.dateKind === 'time' ? 'schedule' : 'calendar_month';
1825
+ return html `<span class="picker" @pointerdown=${this.onPickerPress}
1826
+ ><tanrei-button
1827
+ part="picker-button"
1828
+ class="picker-button"
1829
+ variant="text"
1830
+ size=${this.pickerSize}
1831
+ label=${this.pickerLabel}
1832
+ ?disabled=${this.inert_}
1833
+ @click=${this.onPickerClick}
1834
+ ><span slot="icon">${glyph}</span></tanrei-button
1835
+ ></span>`;
1836
+ }
1837
+ /**
1838
+ * TXI-42, TXI-47: the row of segments — a group named by the label, in one left-to-right run; each segment a spin
1839
+ * button named by its unit and the label, with its range, its value and its value text (segmentEmptyText while it is
1840
+ * empty); the text between them, their placeholders and the copies that give each its width kept from assistive
1841
+ * technology. The shown supporting or error text describes the first segment, and every segment while the field is
1842
+ * in error. A segment's own text is written by `paintSegments()`.
1843
+ */
1844
+ renderRow(row, describedBy) {
1845
+ const inert = this.inert_;
1846
+ const error = this.inError;
1847
+ const last = row.units[row.units.length - 1];
1848
+ let first = true;
1849
+ const segment = (unit) => {
1850
+ const said = spoken(row, this.segments, unit, this.words.get('segmentEmptyText', this.segmentEmptyText));
1851
+ // TXI-52: an empty segment nobody gave words for has no value and no value text.
1852
+ if (said.now === null && said.text === null)
1853
+ this.words.missing('segmentEmptyText', { id: 'TXI-52', effect: 'an empty date or time segment has no value text' });
1854
+ const described = first || error ? describedBy : undefined;
1855
+ first = false;
1856
+ return html `<span class="unit"
1857
+ >${sizersOf(row, this.segments, unit).map((text) => html `<span class="sizer" aria-hidden="true">${text}</span>`)}<span
1858
+ part="segment"
1859
+ class="segment"
1860
+ role="spinbutton"
1861
+ data-unit=${unit}
1862
+ data-placeholder=${placeholderOf(row, unit)}
1863
+ tabindex=${inert ? nothing : '0'}
1864
+ contenteditable=${inert || this.readOnly ? 'false' : 'true'}
1865
+ inputmode=${unit === 'period' ? nothing : 'numeric'}
1866
+ enterkeyhint=${unit === last ? 'done' : 'next'}
1867
+ autocapitalize="none"
1868
+ autocorrect="off"
1869
+ spellcheck="false"
1870
+ dir=${unit === 'period' ? 'auto' : nothing}
1871
+ aria-label=${ifDefined([said.name, this.name_].filter(Boolean).join(', ') || undefined)}
1872
+ aria-valuemin=${said.min}
1873
+ aria-valuemax=${said.max}
1874
+ aria-valuenow=${ifDefined(said.now ?? undefined)}
1875
+ aria-valuetext=${ifDefined(said.text ?? undefined)}
1876
+ aria-describedby=${ifDefined(described)}
1877
+ aria-invalid=${ifDefined(error ? 'true' : undefined)}
1878
+ aria-required=${ifDefined(this.required_ ? 'true' : undefined)}
1879
+ aria-readonly=${ifDefined(this.readOnly ? 'true' : undefined)}
1880
+ aria-disabled=${ifDefined(inert ? 'true' : undefined)}
1881
+ ></span
1882
+ ></span>`;
1883
+ };
1884
+ return html `<div
1885
+ id="input"
1886
+ part="input"
1887
+ class="row"
1888
+ role="group"
1889
+ dir="ltr"
1890
+ aria-label=${ifDefined(this.name_ || undefined)}
1891
+ aria-disabled=${ifDefined(inert ? 'true' : undefined)}
1892
+ ?data-empty=${fill(row, this.segments).held === 0}
1893
+ @keydown=${this.onSegmentKeyDown}
1894
+ @beforeinput=${this.onBeforeInput}
1895
+ @input=${this.onSegmentInput}
1896
+ @compositionstart=${this.onSegmentCompositionStart}
1897
+ @compositionend=${this.onSegmentCompositionEnd}
1898
+ @copy=${this.onCopy}
1899
+ @cut=${this.onCut}
1900
+ @paste=${this.onPaste}
1901
+ >
1902
+ ${row.parts.map((part) => (part.unit ? segment(part.unit) : html `<span class="literal" aria-hidden="true">${part.literal}</span>`))}
1903
+ </div>`;
1904
+ }
1905
+ /** TXI-39, TXI-41: the resize grip — a focusable separator whose value is the lines the input shows (`showLines()` writes it). */
1906
+ renderGrip() {
1907
+ if (!this.gripShown)
1908
+ return nothing;
1909
+ const max = this.maxLines;
1910
+ return html `<div
1911
+ part="resize-grip"
1912
+ class="grip"
1913
+ role="separator"
1914
+ tabindex="0"
1915
+ data-tanrei-shape
1916
+ aria-orientation="horizontal"
1917
+ aria-controls="input"
1918
+ aria-label=${ifDefined(this.gripName || undefined)}
1919
+ aria-valuemin=${this.minLines}
1920
+ aria-valuemax=${ifDefined(max || undefined)}
1921
+ @pointerdown=${this.onGripPointerDown}
1922
+ @pointermove=${this.onGripPointerMove}
1923
+ @pointerup=${this.onGripPointerUp}
1924
+ @pointercancel=${this.onGripPointerCancel}
1925
+ @mousedown=${this.onGripMouseDown}
1926
+ @click=${this.onGripClick}
1927
+ @keydown=${this.onGripKeyDown}
1928
+ @focus=${this.onGripFocus}
1929
+ >
1930
+ <span class="grip-glyph" aria-hidden="true"><span class="ink">${this.axis === 'both' ? 'drag_indicator' : 'drag_handle'}</span></span>
1931
+ </div>
1932
+ ${this.axis === 'both' ? html `<span class="touch-probe" aria-hidden="true"></span>` : nothing}`;
1933
+ }
1934
+ render() {
1935
+ const kind = TYPES[this.type] ?? TYPES.text;
1936
+ const row = this.row;
1937
+ const layout = this.layout;
1938
+ const labelled = this.labelled;
1939
+ const stacked = layout === 'stacked';
1940
+ // TXI-65: while the entries slot holds content the input is not empty for its label.
1941
+ const hasValue = this.shownValue !== '' || this.hasEntries;
1942
+ const affixesShown = !row && (!labelled || hasValue || this.focused);
1943
+ const name = this.name_;
1944
+ const required = this.required_;
1945
+ const described = this.described;
1946
+ const count = this.countText;
1947
+ const describedBy = [
1948
+ affixesShown && this.prefixText ? 'prefix' : '',
1949
+ affixesShown && this.suffixText ? 'suffix' : '',
1950
+ count ? 'counter' : '',
1951
+ described ? 'description' : '',
1952
+ ]
1953
+ .filter(Boolean)
1954
+ .join(' ') || undefined;
1955
+ const rows = this.minLines;
1956
+ const max = this.maxLines;
1957
+ const common = {
1958
+ label: name || undefined,
1959
+ invalid: this.inError ? 'true' : undefined,
1960
+ autocomplete: this.autocomplete || undefined,
1961
+ };
1962
+ const onEvents = {
1963
+ input: this.onInput,
1964
+ change: this.onNativeChange,
1965
+ focus: this.onFocus,
1966
+ blur: this.onBlur,
1967
+ keydown: this.onKeyDown,
1968
+ compositionstart: this.native.onCompositionStart,
1969
+ compositionend: this.native.onCompositionEnd,
1970
+ };
1971
+ // The semantics are the native element's: role (textbox, or searchbox for search), the name (its own `label`, else
1972
+ // its Field's, drawn or not — never the placeholder), the description (the prefix, the suffix and the count, each
1973
+ // by its id, then what its Field gives), invalid, required, read-only and disabled (TXI-11, TXI-19, TXI-23).
1974
+ // TXI-24: typed text is laid out by its own direction (`dir="auto"`) once it has a letter to tell it by. Until then
1975
+ // — an empty field, digits, punctuation — the input keeps the layout's direction, so the caret and the placeholder
1976
+ // stand at the field's start edge (an empty `dir="auto"` input is left to right in every layout). In a multiline
1977
+ // field the styles then give each paragraph its own direction (`textarea.input[dir='auto']`).
1978
+ // TXI-53: never a code field, whose base direction is left-to-right whatever its first strong character is: empty,
1979
+ // holding one bracket or beginning with a string in a right-to-left script, it is laid out alike.
1980
+ const code = !!kind.code;
1981
+ const own = code ? 'ltr' : /\p{L}/u.test(this.value) ? 'auto' : undefined;
1982
+ // TXI-67: beside a value that is always left-to-right — one line of email, url, tel, number or password — the prefix,
1983
+ // the value and the suffix are one run of writing, in the direction of the affixes' first strong character and
1984
+ // left-to-right where they have none: the row's own `dir`, in every layout direction and never read from the value.
1985
+ // A code field's row is left-to-right whatever it holds (TXI-53); every other row is the layout's (TXI-24) — and so
1986
+ // is a row that holds entries, whose lines begin at the field's start edge whatever is typed after them (TXI-64).
1987
+ const run = code ? 'ltr' : kind.ltr && !row && !this.isMultiline && !this.hasEntries ? runDirection(this.prefixText, this.suffixText) : undefined;
1988
+ // TXI-55: what the browser is asked not to do to code, on the native element itself — nothing promises that a host's
1989
+ // attribute reaches an element in a shadow root. No remembered entry while the product names no autofill hint.
1990
+ if (code)
1991
+ common.autocomplete ??= 'off';
1992
+ const control = row
1993
+ ? this.renderRow(row, describedBy)
1994
+ : this.isMultiline
1995
+ ? html `<textarea
1996
+ id="input"
1997
+ part="input"
1998
+ class="input"
1999
+ rows=${rows}
2000
+ .placeholder=${this.hasEntries ? '' : this.placeholder}
2001
+ ?disabled=${this.inert_}
2002
+ ?readonly=${this.readOnly}
2003
+ ?required=${required}
2004
+ dir=${ifDefined(own)}
2005
+ wrap=${this.unwrapped ? 'off' : nothing}
2006
+ autocapitalize=${code ? 'none' : nothing}
2007
+ autocorrect=${code ? 'off' : nothing}
2008
+ spellcheck=${code ? 'false' : nothing}
2009
+ translate=${code ? 'no' : nothing}
2010
+ aria-label=${ifDefined(common.label)}
2011
+ aria-describedby=${ifDefined(describedBy)}
2012
+ aria-invalid=${ifDefined(common.invalid)}
2013
+ autocomplete=${ifDefined(common.autocomplete)}
2014
+ @input=${onEvents.input}
2015
+ @change=${onEvents.change}
2016
+ @focus=${onEvents.focus}
2017
+ @blur=${onEvents.blur}
2018
+ @keydown=${onEvents.keydown}
2019
+ @compositionstart=${onEvents.compositionstart}
2020
+ @compositionend=${onEvents.compositionend}
2021
+ @transitionend=${this.onResizeEnd}
2022
+ @transitioncancel=${this.onResizeEnd}
2023
+ ></textarea>`
2024
+ : html `<input
2025
+ id="input"
2026
+ part="input"
2027
+ class="input"
2028
+ type=${kind.type}
2029
+ inputmode=${ifDefined(kind.inputmode)}
2030
+ enterkeyhint=${ifDefined(kind.enterkeyhint)}
2031
+ autocapitalize=${kind.plain ? 'none' : nothing}
2032
+ autocorrect=${kind.plain ? 'off' : nothing}
2033
+ spellcheck=${kind.plain ? 'false' : nothing}
2034
+ translate=${code ? 'no' : nothing}
2035
+ dir=${ifDefined(kind.ltr ? 'ltr' : own)}
2036
+ .placeholder=${this.hasEntries ? '' : this.placeholder}
2037
+ ?disabled=${this.inert_}
2038
+ ?readonly=${this.readOnly}
2039
+ ?required=${required}
2040
+ aria-label=${ifDefined(common.label)}
2041
+ aria-describedby=${ifDefined(describedBy)}
2042
+ aria-invalid=${ifDefined(common.invalid)}
2043
+ autocomplete=${ifDefined(common.autocomplete)}
2044
+ @input=${onEvents.input}
2045
+ @change=${onEvents.change}
2046
+ @focus=${onEvents.focus}
2047
+ @blur=${onEvents.blur}
2048
+ @keydown=${onEvents.keydown}
2049
+ @compositionstart=${onEvents.compositionstart}
2050
+ @compositionend=${onEvents.compositionend}
2051
+ />`;
2052
+ const floating = !stacked;
2053
+ // TXI-50: the asterisk follows a floating label while the Field says so (FLD-25); hidden from assistive technology,
2054
+ // because the required state already says it.
2055
+ const asterisk = this.asterisked ? html `<span part="requirement-label" class="asterisk" aria-hidden="true">*</span>` : nothing;
2056
+ // The edge: a stacked field's inner line (TXI-26); an outlined field's three-piece outline with the gap for the floated
2057
+ // label, and a filled field's active indicator (TXI-13).
2058
+ const edges = floating
2059
+ ? html `<span part="outline" class="outline" aria-hidden="true"
2060
+ ><span class="outline-start"></span
2061
+ ><span class="outline-notch">${labelled ? html `<span class="notch-label">${name}${asterisk}</span>` : nothing}</span
2062
+ ><span class="outline-end"></span></span
2063
+ ><span part="active-indicator" class="indicator" aria-hidden="true"></span>`
2064
+ : html `<span part="outline" class="edge" aria-hidden="true"></span>`;
2065
+ return html `
2066
+ <div
2067
+ class="field"
2068
+ data-layout=${layout}
2069
+ data-resize=${this.isMultiline ? this.resizeMode : nothing}
2070
+ data-axis=${this.gripShown ? this.axis : nothing}
2071
+ ?data-error=${this.inError}
2072
+ ?data-disabled=${this.inert_}
2073
+ ?data-labelled=${labelled}
2074
+ ?data-has-value=${hasValue}
2075
+ ?data-leading=${this.hasLeading}
2076
+ ?data-trailing=${this.hasTrailing}
2077
+ ?data-entries=${this.hasEntries}
2078
+ ?data-picker=${this.pickerShown}
2079
+ ?data-multiline=${this.isMultiline}
2080
+ ?data-code=${code && !row}
2081
+ ?data-nowrap=${this.unwrapped}
2082
+ >
2083
+ <div
2084
+ part="container"
2085
+ class="container"
2086
+ data-tanrei-shape
2087
+ style=${this.isMultiline ? `--_rows-min: ${rows};${max ? ` --_rows-max: ${max};` : ''}` : nothing}
2088
+ @mousedown=${this.onFieldMouseDown}
2089
+ @focusin=${this.onEntryFocusIn}
2090
+ @focusout=${this.onEntryFocusOut}
2091
+ >
2092
+ <span part="leading-icon" class="icon leading"><slot name="leading-icon" @slotchange=${this.onSlotChange}></slot></span>
2093
+ <div class="body" dir=${(!row && run) || nothing}>
2094
+ <span part="entries" class="entries"><slot name="entries" @slotchange=${this.onSlotChange}></slot></span>
2095
+ <span part="prefix" class="prefix" id="prefix">${row ? nothing : this.prefixText}</span>
2096
+ ${control}
2097
+ <span part="suffix" class="suffix" id="suffix">${row ? nothing : this.suffixText}</span>
2098
+ </div>
2099
+ <span part="trailing-icon" class="icon trailing"><slot name="trailing-icon" @slotchange=${this.onSlotChange}></slot></span>
2100
+ ${this.renderPicker()}
2101
+ ${floating && labelled ? html `<label part="label" class="label" for="input" aria-hidden="true">${name}${asterisk}</label>` : nothing}
2102
+ ${floating && labelled
2103
+ ? html `<span class="measure measure-resting" aria-hidden="true">${name}${asterisk}</span
2104
+ ><span class="measure measure-floated" aria-hidden="true">${name}${asterisk}</span>`
2105
+ : nothing}
2106
+ ${edges} ${this.renderGrip()}
2107
+ </div>
2108
+ ${count ? html `<span id="counter" hidden>${count}</span>` : nothing}${described ? html `<span id="description" hidden>${described}</span>` : nothing}
2109
+ <span class="announcer" role="status" aria-live="polite"></span>
2110
+ </div>
2111
+ `;
2112
+ }
2113
+ }
2114
+ // Its `disabled` attribute, written while it holds focus, waits until focus has left: a frame at most.
2115
+ disabledWaitsWhileFocused(TanreiTextInput);
2116
+ // `autofocus` on it gives it focus when the page first loads too (src/primitives/autofocus.ts).
2117
+ focusedAtFirst(TanreiTextInput);
2118
+ if (!customElements.get('tanrei-text-input'))
2119
+ customElements.define('tanrei-text-input', TanreiTextInput);
2120
+ //# sourceMappingURL=text-input.js.map