@sdxc/ui 0.0.0-pre.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (399) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +812 -0
  3. package/dist/animations/index.d.ts +12 -0
  4. package/dist/animations/index.js +12 -0
  5. package/dist/animations/keyframes.d.ts +162 -0
  6. package/dist/animations/keyframes.js +297 -0
  7. package/dist/animations/scroll.d.ts +154 -0
  8. package/dist/animations/scroll.js +228 -0
  9. package/dist/animations/tokens.d.ts +47 -0
  10. package/dist/animations/tokens.js +47 -0
  11. package/dist/animations/transitions.d.ts +143 -0
  12. package/dist/animations/transitions.js +147 -0
  13. package/dist/behaviors/announcer.d.ts +90 -0
  14. package/dist/behaviors/announcer.js +93 -0
  15. package/dist/behaviors/calendar-model.d.ts +218 -0
  16. package/dist/behaviors/calendar-model.js +376 -0
  17. package/dist/behaviors/drag-session.d.ts +119 -0
  18. package/dist/behaviors/drag-session.js +110 -0
  19. package/dist/behaviors/filter-model.d.ts +117 -0
  20. package/dist/behaviors/filter-model.js +185 -0
  21. package/dist/behaviors/index.d.ts +16 -0
  22. package/dist/behaviors/index.js +16 -0
  23. package/dist/behaviors/resize-session.d.ts +115 -0
  24. package/dist/behaviors/resize-session.js +157 -0
  25. package/dist/behaviors/scroll-follow-model.d.ts +180 -0
  26. package/dist/behaviors/scroll-follow-model.js +197 -0
  27. package/dist/behaviors/selection-model.d.ts +129 -0
  28. package/dist/behaviors/selection-model.js +259 -0
  29. package/dist/behaviors/toaster.d.ts +144 -0
  30. package/dist/behaviors/toaster.js +228 -0
  31. package/dist/components/accordion.d.ts +93 -0
  32. package/dist/components/accordion.js +165 -0
  33. package/dist/components/alert-dialog.d.ts +110 -0
  34. package/dist/components/alert-dialog.js +169 -0
  35. package/dist/components/alert.d.ts +109 -0
  36. package/dist/components/alert.js +160 -0
  37. package/dist/components/aspect-ratio.d.ts +44 -0
  38. package/dist/components/aspect-ratio.js +35 -0
  39. package/dist/components/attachment.d.ts +146 -0
  40. package/dist/components/attachment.js +320 -0
  41. package/dist/components/avatar.d.ts +118 -0
  42. package/dist/components/avatar.js +89 -0
  43. package/dist/components/badge.d.ts +66 -0
  44. package/dist/components/badge.js +129 -0
  45. package/dist/components/breadcrumbs.d.ts +67 -0
  46. package/dist/components/breadcrumbs.js +121 -0
  47. package/dist/components/bubble.d.ts +91 -0
  48. package/dist/components/bubble.js +216 -0
  49. package/dist/components/button.d.ts +78 -0
  50. package/dist/components/button.js +207 -0
  51. package/dist/components/calendar.d.ts +166 -0
  52. package/dist/components/calendar.js +320 -0
  53. package/dist/components/card.d.ts +82 -0
  54. package/dist/components/card.js +126 -0
  55. package/dist/components/carousel.d.ts +96 -0
  56. package/dist/components/carousel.js +214 -0
  57. package/dist/components/chart.d.ts +485 -0
  58. package/dist/components/chart.js +563 -0
  59. package/dist/components/checkbox-group.d.ts +58 -0
  60. package/dist/components/checkbox-group.js +53 -0
  61. package/dist/components/checkbox.d.ts +61 -0
  62. package/dist/components/checkbox.js +81 -0
  63. package/dist/components/color-area.d.ts +83 -0
  64. package/dist/components/color-area.js +251 -0
  65. package/dist/components/color-field.d.ts +128 -0
  66. package/dist/components/color-field.js +73 -0
  67. package/dist/components/color-picker.d.ts +132 -0
  68. package/dist/components/color-picker.js +183 -0
  69. package/dist/components/color-slider.d.ts +103 -0
  70. package/dist/components/color-slider.js +198 -0
  71. package/dist/components/color-swatch-picker.d.ts +106 -0
  72. package/dist/components/color-swatch-picker.js +75 -0
  73. package/dist/components/color-swatch.d.ts +57 -0
  74. package/dist/components/color-swatch.js +82 -0
  75. package/dist/components/color-wheel.d.ts +58 -0
  76. package/dist/components/color-wheel.js +160 -0
  77. package/dist/components/combobox.d.ts +73 -0
  78. package/dist/components/combobox.js +108 -0
  79. package/dist/components/command.d.ts +80 -0
  80. package/dist/components/command.js +151 -0
  81. package/dist/components/confirm.d.ts +124 -0
  82. package/dist/components/confirm.js +56 -0
  83. package/dist/components/context-menu.d.ts +108 -0
  84. package/dist/components/context-menu.js +200 -0
  85. package/dist/components/date-field.d.ts +110 -0
  86. package/dist/components/date-field.js +49 -0
  87. package/dist/components/date-picker.d.ts +136 -0
  88. package/dist/components/date-picker.js +155 -0
  89. package/dist/components/date-range-picker.d.ts +152 -0
  90. package/dist/components/date-range-picker.js +106 -0
  91. package/dist/components/description.d.ts +36 -0
  92. package/dist/components/description.js +21 -0
  93. package/dist/components/dialog.d.ts +97 -0
  94. package/dist/components/dialog.js +203 -0
  95. package/dist/components/disclosure.d.ts +85 -0
  96. package/dist/components/disclosure.js +180 -0
  97. package/dist/components/drawer.d.ts +82 -0
  98. package/dist/components/drawer.js +162 -0
  99. package/dist/components/drop-indicator.d.ts +43 -0
  100. package/dist/components/drop-indicator.js +47 -0
  101. package/dist/components/drop-zone.d.ts +73 -0
  102. package/dist/components/drop-zone.js +54 -0
  103. package/dist/components/empty.d.ts +89 -0
  104. package/dist/components/empty.js +129 -0
  105. package/dist/components/field-error.d.ts +41 -0
  106. package/dist/components/field-error.js +36 -0
  107. package/dist/components/file-trigger.d.ts +84 -0
  108. package/dist/components/file-trigger.js +169 -0
  109. package/dist/components/form.d.ts +118 -0
  110. package/dist/components/form.js +113 -0
  111. package/dist/components/grid-list.d.ts +112 -0
  112. package/dist/components/grid-list.js +220 -0
  113. package/dist/components/group.d.ts +45 -0
  114. package/dist/components/group.js +44 -0
  115. package/dist/components/header.d.ts +33 -0
  116. package/dist/components/header.js +29 -0
  117. package/dist/components/heading-scope.d.ts +83 -0
  118. package/dist/components/heading-scope.js +82 -0
  119. package/dist/components/heading.d.ts +50 -0
  120. package/dist/components/heading.js +31 -0
  121. package/dist/components/hover-card.d.ts +77 -0
  122. package/dist/components/hover-card.js +151 -0
  123. package/dist/components/image-placeholder.d.ts +105 -0
  124. package/dist/components/image-placeholder.js +212 -0
  125. package/dist/components/index.d.ts +109 -0
  126. package/dist/components/index.js +109 -0
  127. package/dist/components/input.d.ts +53 -0
  128. package/dist/components/input.js +76 -0
  129. package/dist/components/item.d.ts +97 -0
  130. package/dist/components/item.js +185 -0
  131. package/dist/components/keyboard.d.ts +33 -0
  132. package/dist/components/keyboard.js +20 -0
  133. package/dist/components/label.d.ts +38 -0
  134. package/dist/components/label.js +24 -0
  135. package/dist/components/link-button.d.ts +59 -0
  136. package/dist/components/link-button.js +174 -0
  137. package/dist/components/link.d.ts +43 -0
  138. package/dist/components/link.js +85 -0
  139. package/dist/components/listbox.d.ts +119 -0
  140. package/dist/components/listbox.js +114 -0
  141. package/dist/components/logo.d.ts +117 -0
  142. package/dist/components/logo.js +89 -0
  143. package/dist/components/marker.d.ts +82 -0
  144. package/dist/components/marker.js +163 -0
  145. package/dist/components/menu.d.ts +90 -0
  146. package/dist/components/menu.js +146 -0
  147. package/dist/components/menubar.d.ts +54 -0
  148. package/dist/components/menubar.js +118 -0
  149. package/dist/components/message-scroller.d.ts +109 -0
  150. package/dist/components/message-scroller.js +180 -0
  151. package/dist/components/message.d.ts +104 -0
  152. package/dist/components/message.js +200 -0
  153. package/dist/components/meter.d.ts +60 -0
  154. package/dist/components/meter.js +110 -0
  155. package/dist/components/modal.d.ts +71 -0
  156. package/dist/components/modal.js +120 -0
  157. package/dist/components/nav-link.d.ts +53 -0
  158. package/dist/components/nav-link.js +83 -0
  159. package/dist/components/navigation-menu.d.ts +150 -0
  160. package/dist/components/navigation-menu.js +381 -0
  161. package/dist/components/number-field.d.ts +76 -0
  162. package/dist/components/number-field.js +190 -0
  163. package/dist/components/otp-field.d.ts +68 -0
  164. package/dist/components/otp-field.js +46 -0
  165. package/dist/components/overlay-arrow.d.ts +51 -0
  166. package/dist/components/overlay-arrow.js +77 -0
  167. package/dist/components/pagination.d.ts +67 -0
  168. package/dist/components/pagination.js +164 -0
  169. package/dist/components/popover.d.ts +69 -0
  170. package/dist/components/popover.js +68 -0
  171. package/dist/components/progress-bar.d.ts +53 -0
  172. package/dist/components/progress-bar.js +90 -0
  173. package/dist/components/radio-group.d.ts +102 -0
  174. package/dist/components/radio-group.js +114 -0
  175. package/dist/components/range-calendar.d.ts +169 -0
  176. package/dist/components/range-calendar.js +216 -0
  177. package/dist/components/resizable.d.ts +98 -0
  178. package/dist/components/resizable.js +151 -0
  179. package/dist/components/scroll-area.d.ts +54 -0
  180. package/dist/components/scroll-area.js +89 -0
  181. package/dist/components/search-field.d.ts +55 -0
  182. package/dist/components/search-field.js +49 -0
  183. package/dist/components/section.d.ts +37 -0
  184. package/dist/components/section.js +22 -0
  185. package/dist/components/select.d.ts +96 -0
  186. package/dist/components/select.js +285 -0
  187. package/dist/components/selection-indicator.d.ts +47 -0
  188. package/dist/components/selection-indicator.js +50 -0
  189. package/dist/components/sentinel-row.d.ts +22 -0
  190. package/dist/components/sentinel-row.js +29 -0
  191. package/dist/components/separator.d.ts +35 -0
  192. package/dist/components/separator.js +48 -0
  193. package/dist/components/shared-element.d.ts +45 -0
  194. package/dist/components/shared-element.js +48 -0
  195. package/dist/components/sheet.d.ts +78 -0
  196. package/dist/components/sheet.js +167 -0
  197. package/dist/components/sidebar.d.ts +288 -0
  198. package/dist/components/sidebar.js +1068 -0
  199. package/dist/components/skeleton.d.ts +36 -0
  200. package/dist/components/skeleton.js +38 -0
  201. package/dist/components/slider.d.ts +102 -0
  202. package/dist/components/slider.js +179 -0
  203. package/dist/components/spinner.d.ts +55 -0
  204. package/dist/components/spinner.js +51 -0
  205. package/dist/components/switch.d.ts +47 -0
  206. package/dist/components/switch.js +82 -0
  207. package/dist/components/table.d.ts +139 -0
  208. package/dist/components/table.js +216 -0
  209. package/dist/components/tabs.d.ts +124 -0
  210. package/dist/components/tabs.js +246 -0
  211. package/dist/components/tag-group.d.ts +83 -0
  212. package/dist/components/tag-group.js +157 -0
  213. package/dist/components/text-field.d.ts +119 -0
  214. package/dist/components/text-field.js +51 -0
  215. package/dist/components/text.d.ts +34 -0
  216. package/dist/components/text.js +19 -0
  217. package/dist/components/textarea.d.ts +52 -0
  218. package/dist/components/textarea.js +82 -0
  219. package/dist/components/time-field.d.ts +110 -0
  220. package/dist/components/time-field.js +48 -0
  221. package/dist/components/toast.d.ts +149 -0
  222. package/dist/components/toast.js +365 -0
  223. package/dist/components/toggle-button.d.ts +115 -0
  224. package/dist/components/toggle-button.js +237 -0
  225. package/dist/components/toolbar.d.ts +47 -0
  226. package/dist/components/toolbar.js +54 -0
  227. package/dist/components/tooltip.d.ts +52 -0
  228. package/dist/components/tooltip.js +92 -0
  229. package/dist/components/tree.d.ts +123 -0
  230. package/dist/components/tree.js +239 -0
  231. package/dist/components/typeset.d.ts +53 -0
  232. package/dist/components/typeset.js +271 -0
  233. package/dist/index.d.ts +8 -0
  234. package/dist/index.js +8 -0
  235. package/dist/mixins/aria-checked.d.ts +42 -0
  236. package/dist/mixins/aria-checked.js +127 -0
  237. package/dist/mixins/attachment-trigger.d.ts +64 -0
  238. package/dist/mixins/attachment-trigger.js +190 -0
  239. package/dist/mixins/calendar-keys.d.ts +27 -0
  240. package/dist/mixins/calendar-keys.js +113 -0
  241. package/dist/mixins/carousel-controls.d.ts +30 -0
  242. package/dist/mixins/carousel-controls.js +222 -0
  243. package/dist/mixins/chart-tooltip.d.ts +118 -0
  244. package/dist/mixins/chart-tooltip.js +323 -0
  245. package/dist/mixins/clear-field.d.ts +60 -0
  246. package/dist/mixins/clear-field.js +100 -0
  247. package/dist/mixins/color-area-drag.d.ts +58 -0
  248. package/dist/mixins/color-area-drag.js +162 -0
  249. package/dist/mixins/color-channel-sync.d.ts +73 -0
  250. package/dist/mixins/color-channel-sync.js +169 -0
  251. package/dist/mixins/color-preview.d.ts +28 -0
  252. package/dist/mixins/color-preview.js +77 -0
  253. package/dist/mixins/color-wheel-drag.d.ts +58 -0
  254. package/dist/mixins/color-wheel-drag.js +139 -0
  255. package/dist/mixins/combobox-filter.d.ts +59 -0
  256. package/dist/mixins/combobox-filter.js +81 -0
  257. package/dist/mixins/command-filter.d.ts +55 -0
  258. package/dist/mixins/command-filter.js +121 -0
  259. package/dist/mixins/command-keys.d.ts +31 -0
  260. package/dist/mixins/command-keys.js +116 -0
  261. package/dist/mixins/context-menu.d.ts +24 -0
  262. package/dist/mixins/context-menu.js +64 -0
  263. package/dist/mixins/copy-to-clipboard.d.ts +64 -0
  264. package/dist/mixins/copy-to-clipboard.js +109 -0
  265. package/dist/mixins/dismiss.d.ts +77 -0
  266. package/dist/mixins/dismiss.js +151 -0
  267. package/dist/mixins/drag-reorder.d.ts +88 -0
  268. package/dist/mixins/drag-reorder.js +214 -0
  269. package/dist/mixins/drop-zone.d.ts +52 -0
  270. package/dist/mixins/drop-zone.js +132 -0
  271. package/dist/mixins/dual-range.d.ts +60 -0
  272. package/dist/mixins/dual-range.js +100 -0
  273. package/dist/mixins/grid-list-keys.d.ts +34 -0
  274. package/dist/mixins/grid-list-keys.js +260 -0
  275. package/dist/mixins/heading-level-fallback.d.ts +81 -0
  276. package/dist/mixins/heading-level-fallback.js +112 -0
  277. package/dist/mixins/hotkey.d.ts +26 -0
  278. package/dist/mixins/hotkey.js +132 -0
  279. package/dist/mixins/image-fallback.d.ts +57 -0
  280. package/dist/mixins/image-fallback.js +86 -0
  281. package/dist/mixins/index.d.ts +48 -0
  282. package/dist/mixins/index.js +48 -0
  283. package/dist/mixins/listbox-keys.d.ts +52 -0
  284. package/dist/mixins/listbox-keys.js +63 -0
  285. package/dist/mixins/long-press.d.ts +76 -0
  286. package/dist/mixins/long-press.js +130 -0
  287. package/dist/mixins/menu-keys.d.ts +40 -0
  288. package/dist/mixins/menu-keys.js +117 -0
  289. package/dist/mixins/menubar-keys.d.ts +59 -0
  290. package/dist/mixins/menubar-keys.js +230 -0
  291. package/dist/mixins/message-follow.d.ts +56 -0
  292. package/dist/mixins/message-follow.js +368 -0
  293. package/dist/mixins/otp-slots.d.ts +53 -0
  294. package/dist/mixins/otp-slots.js +175 -0
  295. package/dist/mixins/persist.d.ts +36 -0
  296. package/dist/mixins/persist.js +78 -0
  297. package/dist/mixins/press-toggle.d.ts +43 -0
  298. package/dist/mixins/press-toggle.js +61 -0
  299. package/dist/mixins/range-preview.d.ts +26 -0
  300. package/dist/mixins/range-preview.js +120 -0
  301. package/dist/mixins/resize-handle.d.ts +101 -0
  302. package/dist/mixins/resize-handle.js +288 -0
  303. package/dist/mixins/stepper.d.ts +81 -0
  304. package/dist/mixins/stepper.js +194 -0
  305. package/dist/mixins/tab-keys.d.ts +30 -0
  306. package/dist/mixins/tab-keys.js +63 -0
  307. package/dist/mixins/theme-toggle.d.ts +82 -0
  308. package/dist/mixins/theme-toggle.js +158 -0
  309. package/dist/mixins/track-host-node.d.ts +34 -0
  310. package/dist/mixins/track-host-node.js +42 -0
  311. package/dist/mixins/treeKeys.d.ts +57 -0
  312. package/dist/mixins/treeKeys.js +266 -0
  313. package/dist/mixins/validate.d.ts +65 -0
  314. package/dist/mixins/validate.js +139 -0
  315. package/dist/mixins/view-transition.d.ts +56 -0
  316. package/dist/mixins/view-transition.js +111 -0
  317. package/dist/styles/chart-palette.d.ts +34 -0
  318. package/dist/styles/chart-palette.js +27 -0
  319. package/dist/styles/field-stack-layout.d.ts +27 -0
  320. package/dist/styles/field-stack-layout.js +16 -0
  321. package/dist/styles/floating-surface.d.ts +32 -0
  322. package/dist/styles/floating-surface.js +30 -0
  323. package/dist/styles/graphic-host.d.ts +25 -0
  324. package/dist/styles/graphic-host.js +18 -0
  325. package/dist/styles/index.d.ts +20 -0
  326. package/dist/styles/index.js +20 -0
  327. package/dist/styles/interactive-transition.d.ts +32 -0
  328. package/dist/styles/interactive-transition.js +32 -0
  329. package/dist/styles/legend-toggle.d.ts +29 -0
  330. package/dist/styles/legend-toggle.js +24 -0
  331. package/dist/styles/output-caption-text.d.ts +22 -0
  332. package/dist/styles/output-caption-text.js +15 -0
  333. package/dist/styles/panel-chrome.d.ts +34 -0
  334. package/dist/styles/panel-chrome.js +26 -0
  335. package/dist/styles/range-thumb-appearance.d.ts +36 -0
  336. package/dist/styles/range-thumb-appearance.js +76 -0
  337. package/dist/styles/rtl-aware-gradient-direction.d.ts +28 -0
  338. package/dist/styles/rtl-aware-gradient-direction.js +28 -0
  339. package/dist/styles/semantic-color-panel.d.ts +35 -0
  340. package/dist/styles/semantic-color-panel.js +41 -0
  341. package/dist/utils/chart-marker-indices.d.ts +22 -0
  342. package/dist/utils/chart-marker-indices.js +45 -0
  343. package/dist/utils/chart-path.d.ts +86 -0
  344. package/dist/utils/chart-path.js +122 -0
  345. package/dist/utils/chart-scale.d.ts +182 -0
  346. package/dist/utils/chart-scale.js +221 -0
  347. package/dist/utils/color-math.d.ts +252 -0
  348. package/dist/utils/color-math.js +480 -0
  349. package/dist/utils/command-event.d.ts +24 -0
  350. package/dist/utils/command-event.js +26 -0
  351. package/dist/utils/css-styles.d.ts +21 -0
  352. package/dist/utils/css-styles.js +11 -0
  353. package/dist/utils/decorative-icon.d.ts +15 -0
  354. package/dist/utils/decorative-icon.js +15 -0
  355. package/dist/utils/disabled-selector.d.ts +22 -0
  356. package/dist/utils/disabled-selector.js +22 -0
  357. package/dist/utils/dispatch-change.d.ts +17 -0
  358. package/dist/utils/dispatch-change.js +19 -0
  359. package/dist/utils/field-parts.d.ts +26 -0
  360. package/dist/utils/field-parts.js +12 -0
  361. package/dist/utils/full-turn-radians.d.ts +16 -0
  362. package/dist/utils/full-turn-radians.js +16 -0
  363. package/dist/utils/geometry.d.ts +14 -0
  364. package/dist/utils/geometry.js +9 -0
  365. package/dist/utils/has-accessible-text.d.ts +19 -0
  366. package/dist/utils/has-accessible-text.js +30 -0
  367. package/dist/utils/hue-spectrum.d.ts +19 -0
  368. package/dist/utils/hue-spectrum.js +19 -0
  369. package/dist/utils/index.d.ts +35 -0
  370. package/dist/utils/index.js +35 -0
  371. package/dist/utils/is-new-primary-press.d.ts +29 -0
  372. package/dist/utils/is-new-primary-press.js +31 -0
  373. package/dist/utils/keyboard-nav.d.ts +64 -0
  374. package/dist/utils/keyboard-nav.js +79 -0
  375. package/dist/utils/merge-style.d.ts +33 -0
  376. package/dist/utils/merge-style.js +30 -0
  377. package/dist/utils/paired-range-inputs.d.ts +26 -0
  378. package/dist/utils/paired-range-inputs.js +29 -0
  379. package/dist/utils/placement.d.ts +18 -0
  380. package/dist/utils/placement.js +12 -0
  381. package/dist/utils/prefers-reduced-motion.d.ts +17 -0
  382. package/dist/utils/prefers-reduced-motion.js +19 -0
  383. package/dist/utils/resolve-field-wiring.d.ts +83 -0
  384. package/dist/utils/resolve-field-wiring.js +53 -0
  385. package/dist/utils/resolve-fill-percent.d.ts +28 -0
  386. package/dist/utils/resolve-fill-percent.js +34 -0
  387. package/dist/utils/round-precision.d.ts +22 -0
  388. package/dist/utils/round-precision.js +25 -0
  389. package/dist/utils/semantic-color-panel.d.ts +35 -0
  390. package/dist/utils/semantic-color-panel.js +28 -0
  391. package/dist/utils/semantic-color.d.ts +17 -0
  392. package/dist/utils/semantic-color.js +11 -0
  393. package/dist/utils/warn-if-no-accessible-name.d.ts +52 -0
  394. package/dist/utils/warn-if-no-accessible-name.js +55 -0
  395. package/dist/utils/write-cookie.d.ts +35 -0
  396. package/dist/utils/write-cookie.js +37 -0
  397. package/package.json +32 -0
  398. package/src/reset.css +223 -0
  399. package/src/theme.css +146 -0
@@ -0,0 +1,246 @@
1
+ import { jsx as _jsx } from "remix/ui/jsx-runtime";
2
+ import { bg, borderEdge, fg, outline, outlineStyle } from "@sdxc/u/color";
3
+ import { opacity, transition } from "@sdxc/u/effects";
4
+ import { cursor, raw } from "@sdxc/u/general";
5
+ import { absolute, basis, flexCol, flexRow, grow, hstack, insBe, insIs, inset, relative, shrink, vstack, } from "@sdxc/u/layout";
6
+ import { bs, is, mbe, mie, pb, pi } from "@sdxc/u/size";
7
+ import { after, data, when } from "@sdxc/u/state";
8
+ import { boxLength, spacing } from "@sdxc/u/tokens";
9
+ import { text, weight } from "@sdxc/u/typography";
10
+ import { attrs } from "remix/ui";
11
+ import { interactiveTransition } from "../styles/interactive-transition.js";
12
+ /** Default {@link Tabs.Props} orientation, applied when `orientation` is omitted. */
13
+ const DEFAULT_ORIENTATION = "horizontal";
14
+ /** `role="tablist"` applied to {@link Tabs.List} through {@link attrs} unless a consumer supplies its own `role`. */
15
+ const DEFAULT_LIST_ROLE = "tablist";
16
+ /** `role="tab"` applied to {@link Tabs.Tab} through {@link attrs} unless a consumer supplies its own `role`. */
17
+ const DEFAULT_TAB_ROLE = "tab";
18
+ /** `role="tabpanel"` applied to {@link Tabs.Panel} through {@link attrs} unless a consumer supplies its own `role`. */
19
+ const DEFAULT_PANEL_ROLE = "tabpanel";
20
+ /**
21
+ * {@link Tabs.List}'s own inter-tab gap, applied through `hstack({ gap:
22
+ * LIST_GAP })` and reused when computing a controlled `activeIndex`'s
23
+ * indicator offset (see {@link tabIndicatorMix}), keeping the two in sync.
24
+ */
25
+ const LIST_GAP = 1;
26
+ /**
27
+ * Default {@link Tabs.PanelProps.tabIndex}, applied through {@link attrs}
28
+ * unless a consumer supplies its own, so a keyboard user can move focus
29
+ * straight into the panel's content after activating a tab.
30
+ */
31
+ const DEFAULT_PANEL_TAB_INDEX = 0;
32
+ /**
33
+ * Renders the root host: a plain `<div>` stacking {@link Tabs.List} above
34
+ * {@link Tabs.Panels}, switching to a side-by-side row when `orientation`
35
+ * is `"vertical"` and sharing that axis through component context.
36
+ *
37
+ * @param handle Runtime handle carrying the host `<div>`'s props and providing {@link Tabs.Context}.
38
+ * @returns The render function producing the root's markup.
39
+ * @example
40
+ * <Tabs>
41
+ * <Tabs.List aria-label={t("settings.sections")}>
42
+ * <Tabs.Tab href="/settings/profile" aria-selected="true">{t("settings.profile")}</Tabs.Tab>
43
+ * <Tabs.Tab href="/settings/billing" aria-selected="false">{t("settings.billing")}</Tabs.Tab>
44
+ * </Tabs.List>
45
+ * <Tabs.Panels>
46
+ * <Tabs.Panel>{t("settings.profile.body")}</Tabs.Panel>
47
+ * </Tabs.Panels>
48
+ * </Tabs>
49
+ * @example
50
+ * <Tabs orientation="vertical">
51
+ * <Tabs.List aria-label={t("settings.sections")}>
52
+ * <Tabs.Tab href="/settings/profile" aria-selected="true">{t("settings.profile")}</Tabs.Tab>
53
+ * <Tabs.Tab href="/settings/billing" aria-selected="false">{t("settings.billing")}</Tabs.Tab>
54
+ * </Tabs.List>
55
+ * <Tabs.Panels>
56
+ * <Tabs.Panel>{t("settings.profile.body")}</Tabs.Panel>
57
+ * </Tabs.Panels>
58
+ * </Tabs>
59
+ */
60
+ export function Tabs(handle) {
61
+ return () => {
62
+ let { orientation, mix, ...rest } = handle.props;
63
+ let resolvedOrientation = orientation ?? DEFAULT_ORIENTATION;
64
+ handle.context.set({ orientation: resolvedOrientation });
65
+ return (_jsx("div", { "data-orientation": resolvedOrientation, ...rest, mix: [vstack(), data("orientation", "vertical", flexRow()), mix] }));
66
+ };
67
+ }
68
+ /**
69
+ * Computes the `--ui-tab-indicator-*` custom properties {@link Tabs.List}'s
70
+ * sliding indicator reads for a controlled `activeIndex`. Assumes every
71
+ * {@link Tabs.Tab} shares one fixed `tabSize` and sits `LIST_GAP` apart.
72
+ *
73
+ * @param orientation The enclosing {@link Tabs}'s layout axis.
74
+ * @param activeIndex Index of the active tab among its siblings.
75
+ * @param tabSize Every tab's fixed size along `orientation`'s axis.
76
+ * @returns A `raw()` mixin setting the indicator's offset, length, and opacity.
77
+ */
78
+ export function tabIndicatorMix(orientation, activeIndex, tabSize) {
79
+ let size = boxLength(tabSize);
80
+ let offset = `calc((${size} + ${spacing(LIST_GAP)}) * ${activeIndex})`;
81
+ if (orientation === "vertical") {
82
+ return raw({
83
+ "--ui-tab-indicator-block-start": offset,
84
+ "--ui-tab-indicator-block-size": size,
85
+ "--ui-tab-indicator-opacity": "1",
86
+ });
87
+ }
88
+ return raw({
89
+ "--ui-tab-indicator-inline-start": offset,
90
+ "--ui-tab-indicator-inline-size": size,
91
+ "--ui-tab-indicator-opacity": "1",
92
+ });
93
+ }
94
+ /**
95
+ * Renders the tab strip: a `role="tablist"` host laying {@link Tabs.Tab}
96
+ * links out in a row, or a column when `orientation` is `"vertical"`, with
97
+ * a sliding accent bar reading `--ui-tab-indicator-*` custom properties.
98
+ *
99
+ * @param handle Runtime handle carrying the host's props.
100
+ * @returns The render function producing the tab strip's markup.
101
+ * @example
102
+ * <Tabs.List aria-label={t("settings.sections")}>
103
+ * <Tabs.Tab href="/settings/profile" aria-selected="true">{t("settings.profile")}</Tabs.Tab>
104
+ * <Tabs.Tab href="/settings/billing" aria-selected="false">{t("settings.billing")}</Tabs.Tab>
105
+ * </Tabs.List>
106
+ * @example
107
+ * // A link-based, server-controlled tab bar: `activeIndex` comes from the
108
+ * // current route, so `Tabs.List` computes its own sliding indicator
109
+ * // directly from server-rendered state.
110
+ * <Tabs.List aria-label={t("dashboard.tabs")} activeIndex={activeIndex} tabSize="110px">
111
+ * <Tabs.Tab href="/dashboard/overview" aria-selected={activeIndex === 0}>
112
+ * {t("dashboard.overview")}
113
+ * </Tabs.Tab>
114
+ * <Tabs.Tab href="/dashboard/incidents" aria-selected={activeIndex === 1}>
115
+ * {t("dashboard.incidents")}
116
+ * </Tabs.Tab>
117
+ * </Tabs.List>
118
+ */
119
+ Tabs.List = function TabsList(handle) {
120
+ return () => {
121
+ let { mix, activeIndex, tabSize, ...rest } = handle.props;
122
+ let context = handle.context.get(Tabs);
123
+ let indicatorMix = activeIndex !== undefined && tabSize !== undefined
124
+ ? tabIndicatorMix(context.orientation, activeIndex, tabSize)
125
+ : undefined;
126
+ return (_jsx("div", { "data-orientation": context.orientation, "aria-orientation": context.orientation, ...rest, mix: [
127
+ attrs({ role: DEFAULT_LIST_ROLE }),
128
+ relative(),
129
+ hstack({ gap: LIST_GAP }),
130
+ borderEdge("block-end", { color: "neutral", width: 1 }),
131
+ after([
132
+ absolute(),
133
+ is("var(--ui-tab-indicator-inline-size, 0px)"),
134
+ bs("0.125rem"),
135
+ transition("inset-inline-start, inset-block-start, inline-size, block-size, opacity", {
136
+ duration: "200ms",
137
+ easing: "ease-out",
138
+ }),
139
+ insIs("var(--ui-tab-indicator-inline-start, 0px)"),
140
+ insBe("-0.0625rem"),
141
+ bg("var(--ui-brand-fg)"),
142
+ raw({
143
+ content: '""',
144
+ opacity: "var(--ui-tab-indicator-opacity, 0)",
145
+ }),
146
+ ]),
147
+ data("orientation", "vertical", [
148
+ flexCol(),
149
+ borderEdge("block-end", { width: "0" }),
150
+ borderEdge("inline-end", { color: "neutral", width: 1 }),
151
+ after([
152
+ inset("var(--ui-tab-indicator-block-start, 0px)", "0", "auto", "auto"),
153
+ is("0.125rem"),
154
+ bs("var(--ui-tab-indicator-block-size, 0px)"),
155
+ ]),
156
+ ]),
157
+ indicatorMix,
158
+ mix,
159
+ ] }));
160
+ };
161
+ };
162
+ /**
163
+ * Renders a single tab: a native `<a>` carrying the `tab` role, its own
164
+ * border edge kept transparent to reserve space for the sliding indicator.
165
+ * Omitting `href` disables navigation; pair it with `aria-disabled="true"`.
166
+ *
167
+ * @param handle Runtime handle carrying the host `<a>`'s props.
168
+ * @returns The render function producing the tab's markup.
169
+ * @example
170
+ * <Tabs.Tab href="/settings/profile" aria-selected="true">{t("settings.profile")}</Tabs.Tab>
171
+ * @example
172
+ * <Tabs.Tab href="/settings/billing" aria-selected="false" aria-disabled="true">
173
+ * {t("settings.billing")}
174
+ * </Tabs.Tab>
175
+ */
176
+ Tabs.Tab = function TabsTab(handle) {
177
+ return () => {
178
+ let { mix, ...rest } = handle.props;
179
+ let context = handle.context.get(Tabs);
180
+ return (_jsx("a", { "data-orientation": context.orientation, ...rest, mix: [
181
+ interactiveTransition(),
182
+ attrs({ role: DEFAULT_TAB_ROLE }),
183
+ when("&:focus-visible", outline({ color: "brand.ring", offset: 2 })),
184
+ pi(4),
185
+ pb(2),
186
+ weight(500),
187
+ fg("neutral"),
188
+ when("&:hover", fg("neutral.emphasis")),
189
+ when('&[aria-selected="true"]', fg("brand")),
190
+ when('&[aria-disabled="true"]', opacity(50)),
191
+ mbe("-0.0625rem"),
192
+ cursor("default"),
193
+ text("sm"),
194
+ borderEdge("block-end", { color: "transparent", width: 2 }),
195
+ when('&[aria-disabled="true"]', cursor("not-allowed")),
196
+ data("orientation", "vertical", [
197
+ mbe("0"),
198
+ mie("-0.0625rem"),
199
+ borderEdge("block-end", { width: "0" }),
200
+ borderEdge("inline-end", { color: "transparent", width: 2 }),
201
+ ]),
202
+ mix,
203
+ ] }));
204
+ };
205
+ };
206
+ /**
207
+ * Renders the panel region: a `<div>` growing to fill whatever space is left
208
+ * beside or beneath {@link Tabs.List}. Nest the current tab's
209
+ * {@link Tabs.Panel} inside it.
210
+ *
211
+ * @param handle Runtime handle carrying the host `<div>`'s props.
212
+ * @returns The render function producing the panel region's markup.
213
+ * @example
214
+ * <Tabs.Panels>
215
+ * <Tabs.Panel>{t("settings.profile.body")}</Tabs.Panel>
216
+ * </Tabs.Panels>
217
+ */
218
+ Tabs.Panels = function TabsPanels(handle) {
219
+ return () => {
220
+ let { mix, ...rest } = handle.props;
221
+ return _jsx("div", { ...rest, mix: [grow(), shrink(1), basis("0%"), mix] });
222
+ };
223
+ };
224
+ /**
225
+ * Renders the current tab's content: a padded `<div>` carrying the
226
+ * `tabpanel` role, focusable by default so a keyboard user can jump
227
+ * straight into it after activating a tab, with a focus-visible ring.
228
+ *
229
+ * @param handle Runtime handle carrying the host `<div>`'s props.
230
+ * @returns The render function producing the panel's markup.
231
+ * @example
232
+ * <Tabs.Panel>{t("settings.profile.body")}</Tabs.Panel>
233
+ */
234
+ Tabs.Panel = function TabsPanel(handle) {
235
+ return () => {
236
+ let { mix, ...rest } = handle.props;
237
+ return (_jsx("div", { ...rest, mix: [
238
+ attrs({ role: DEFAULT_PANEL_ROLE, tabIndex: DEFAULT_PANEL_TAB_INDEX }),
239
+ when("&:focus-visible", outline({ color: "brand.ring", offset: 2 })),
240
+ pb(4),
241
+ pi(4),
242
+ outlineStyle("none"),
243
+ mix,
244
+ ] }));
245
+ };
246
+ };
@@ -0,0 +1,83 @@
1
+ /**
2
+ * A labeled set of pill-shaped tags with an optional dismiss control per tag,
3
+ * composing a grouping host, a wrapped list, and each tag's own pill and
4
+ * remove button. A tag reads its color and size through the same `data-*`
5
+ * contract as {@link Badge}, and its remove control renders through
6
+ * {@link Button} as a native form submit, so removing a tag is an ordinary
7
+ * server round-trip through whatever form the group sits inside, driven
8
+ * entirely by the submitted control's `name`/`value` pair.
9
+ *
10
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
11
+ * @copyright Sergio Xalambrí 2026
12
+ */
13
+ import type { Handle, Props as ElementProps } from "remix/ui";
14
+ import type { SemanticColor } from "../utils/semantic-color.js";
15
+ import { Button } from "./button.js";
16
+ /**
17
+ * Prop types for {@link TagGroup} and its compound parts.
18
+ */
19
+ export declare namespace TagGroup {
20
+ /**
21
+ * Semantic color role, each mapped to its matching `--ui-*` variables —
22
+ * the same set {@link Badge} and {@link Button} use.
23
+ */
24
+ type Color = SemanticColor;
25
+ /**
26
+ * Size variant controlling a tag's padding and font size.
27
+ */
28
+ type Size = "sm" | "md";
29
+ /**
30
+ * Props accepted by {@link TagGroup}.
31
+ */
32
+ interface Props extends ElementProps<"div"> {
33
+ }
34
+ /**
35
+ * Props accepted by {@link TagGroup.List}.
36
+ */
37
+ interface ListProps extends ElementProps<"ul"> {
38
+ }
39
+ /**
40
+ * Props accepted by {@link TagGroup.Tag}. Set `aria-selected="true"` to
41
+ * mark a tag as the active member of a selectable set, and
42
+ * `aria-disabled="true"` to mute one, both read from native ARIA state.
43
+ */
44
+ interface TagProps extends ElementProps<"li"> {
45
+ /** Semantic color role. Defaults to {@link DEFAULT_COLOR}. */
46
+ color?: Color;
47
+ /** Size variant. Defaults to {@link DEFAULT_SIZE}. */
48
+ size?: Size;
49
+ }
50
+ /**
51
+ * Props accepted by {@link TagGroup.Remove}: every {@link Button.Props}
52
+ * field except the ones this component fixes, plus every native
53
+ * `<button>` attribute — `name`/`value` tell the form which tag to remove.
54
+ */
55
+ interface RemoveProps extends Omit<Button.Props, "children" | "variant" | "color" | "size" | "type" | "aria-label"> {
56
+ /**
57
+ * Accessible label for the icon-only control — required, since the
58
+ * button carries no visible text for assistive technology to read.
59
+ */
60
+ "aria-label": string;
61
+ }
62
+ }
63
+ /**
64
+ * Renders the group's `<div>` host, laying its {@link TagGroup.List} child
65
+ * (and any preceding `Label`) out in a column with a small gap. Dev mode
66
+ * warns when it lacks an accessible name for assistive technology.
67
+ *
68
+ * @param handle Runtime handle carrying the host `<div>`'s props.
69
+ * @returns The render function producing the group's markup.
70
+ * @example
71
+ * <TagGroup aria-label={t("skills.label")}>
72
+ * <TagGroup.List>
73
+ * <TagGroup.Tag color="brand">{t("skills.design")}</TagGroup.Tag>
74
+ * <TagGroup.Tag color="success">{t("skills.shipped")}</TagGroup.Tag>
75
+ * </TagGroup.List>
76
+ * </TagGroup>
77
+ */
78
+ export declare function TagGroup(handle: Handle<TagGroup.Props>): () => import("remix/ui").RemixElement;
79
+ export declare namespace TagGroup {
80
+ var List: (handle: Handle<TagGroup.ListProps>) => () => import("remix/ui").RemixElement;
81
+ var Tag: (handle: Handle<TagGroup.TagProps>) => () => import("remix/ui").RemixElement;
82
+ var Remove: (handle: Handle<TagGroup.RemoveProps>) => () => import("remix/ui").RemixElement;
83
+ }
@@ -0,0 +1,157 @@
1
+ import { jsx as _jsx } from "remix/ui/jsx-runtime";
2
+ import { XIcon } from "@sdxc/icons";
3
+ import { bg, fg, outline, outlineColor } from "@sdxc/u/color";
4
+ import { opacity, rounded } from "@sdxc/u/effects";
5
+ import { cursor, listStyle } from "@sdxc/u/general";
6
+ import { flex, flexWrap, gap, inlineFlex, items, vstack } from "@sdxc/u/layout";
7
+ import { bs, is, m, mie, p, pb, pi } from "@sdxc/u/size";
8
+ import { active, data, hover, when } from "@sdxc/u/state";
9
+ import { text, weight } from "@sdxc/u/typography";
10
+ import { attrs } from "remix/ui";
11
+ import { interactiveTransition } from "../styles/interactive-transition.js";
12
+ import { warnIfNoAccessibleLabel } from "../utils/warn-if-no-accessible-name.js";
13
+ import { Button } from "./button.js";
14
+ /** `role="group"` applied to {@link TagGroup} through {@link attrs} unless a consumer supplies its own `role`. */
15
+ const DEFAULT_ROLE = "group";
16
+ /** Semantic color role {@link TagGroup.Tag} falls back to when `color` is omitted. */
17
+ const DEFAULT_COLOR = "neutral";
18
+ /** Size variant {@link TagGroup.Tag} falls back to when `size` is omitted. */
19
+ const DEFAULT_SIZE = "md";
20
+ /**
21
+ * Renders the group's `<div>` host, laying its {@link TagGroup.List} child
22
+ * (and any preceding `Label`) out in a column with a small gap. Dev mode
23
+ * warns when it lacks an accessible name for assistive technology.
24
+ *
25
+ * @param handle Runtime handle carrying the host `<div>`'s props.
26
+ * @returns The render function producing the group's markup.
27
+ * @example
28
+ * <TagGroup aria-label={t("skills.label")}>
29
+ * <TagGroup.List>
30
+ * <TagGroup.Tag color="brand">{t("skills.design")}</TagGroup.Tag>
31
+ * <TagGroup.Tag color="success">{t("skills.shipped")}</TagGroup.Tag>
32
+ * </TagGroup.List>
33
+ * </TagGroup>
34
+ */
35
+ export function TagGroup(handle) {
36
+ return () => {
37
+ let { mix, ...rest } = handle.props;
38
+ warnIfNoAccessibleLabel(handle.props, 'TagGroup: a group with no "aria-label" or "aria-labelledby" needs one describing the set of tags — assistive technology has no accessible name to announce otherwise.');
39
+ return (_jsx("div", { ...rest, "data-slot": "tag-group", mix: [attrs({ role: DEFAULT_ROLE }), vstack({ gap: 1 }), mix] }));
40
+ };
41
+ }
42
+ /**
43
+ * Renders the group's `<ul>` list, resetting native list markers and spacing
44
+ * and laying {@link TagGroup.Tag} children out as a wrapped row with a small
45
+ * gap between them.
46
+ *
47
+ * @param handle Runtime handle carrying the host `<ul>`'s props.
48
+ * @returns The render function producing the list's markup.
49
+ * @example
50
+ * <TagGroup.List>
51
+ * <TagGroup.Tag color="neutral">{t("filters.active")}</TagGroup.Tag>
52
+ * <TagGroup.Tag color="neutral" size="sm">{t("filters.archived")}</TagGroup.Tag>
53
+ * </TagGroup.List>
54
+ */
55
+ TagGroup.List = function TagGroupList(handle) {
56
+ return () => {
57
+ let { mix, ...rest } = handle.props;
58
+ return (_jsx("ul", { ...rest, "data-slot": "list", mix: [flex(), flexWrap("wrap"), gap(2), m(0), p(0), listStyle(), mix] }));
59
+ };
60
+ };
61
+ /**
62
+ * Renders a single pill-shaped `<li>`, colored through the `data-color`
63
+ * attribute contract shared with {@link Badge} and sized through
64
+ * `data-size`. Compose {@link TagGroup.Remove} inside it for a dismissible tag.
65
+ *
66
+ * @param handle Runtime handle carrying the host `<li>`'s props.
67
+ * @returns The render function producing the pill's markup.
68
+ * @example
69
+ * <TagGroup.Tag color="success">{t("status.shipped")}</TagGroup.Tag>
70
+ * @example
71
+ * <TagGroup.Tag color="danger" size="sm" aria-selected="true">
72
+ * {t("status.blocked")}
73
+ * </TagGroup.Tag>
74
+ */
75
+ TagGroup.Tag = function TagGroupTag(handle) {
76
+ return () => {
77
+ let { color, size, mix, ...rest } = handle.props;
78
+ let resolvedColor = color ?? DEFAULT_COLOR;
79
+ let resolvedSize = size ?? DEFAULT_SIZE;
80
+ return (_jsx("li", { ...rest, "data-color": resolvedColor, "data-size": resolvedSize, "data-slot": "tag", mix: [
81
+ when("&:focus-visible", [
82
+ outline({ color: "brand.ring", offset: 2 }),
83
+ data("color", "neutral", outline("neutral.ring")),
84
+ data("color", "success", outline("success.ring")),
85
+ data("color", "warning", outline("warning.ring")),
86
+ data("color", "danger", outline("danger.ring")),
87
+ ]),
88
+ interactiveTransition(),
89
+ inlineFlex(),
90
+ items("center"),
91
+ gap(1),
92
+ rounded("full"),
93
+ pi(3),
94
+ pb(1),
95
+ data("size", "sm", [pi(2), pb(0.5)]),
96
+ data("color", "brand", [bg("brand.tint"), fg("brand")]),
97
+ data("color", "success", [bg("success.tint"), fg("success")]),
98
+ data("color", "warning", [bg("warning.tint"), fg("warning")]),
99
+ data("color", "danger", [bg("danger.tint"), fg("danger")]),
100
+ when('&[aria-selected="true"]', [bg("brand.solid"), fg("brand.onSolid"), weight(600)]),
101
+ when('&[aria-disabled="true"]', opacity(50)),
102
+ cursor("default"),
103
+ text("sm"),
104
+ data("size", "sm", text("xs")),
105
+ data("color", "neutral", [bg("neutral.bg-tint-hover"), fg("neutral")]),
106
+ mix,
107
+ ] }));
108
+ };
109
+ };
110
+ /**
111
+ * Renders a dismiss control for the tag it's composed inside: a small,
112
+ * ghost-styled {@link Button} with an "X" glyph submitting as
113
+ * `type="submit"`, colored from the ambient {@link TagGroup.Tag}'s `data-color`.
114
+ *
115
+ * @param handle Runtime handle carrying the host button's props.
116
+ * @returns The render function producing the dismiss control's markup.
117
+ * @example
118
+ * <form method="post">
119
+ * <TagGroup aria-label={t("filters.label")}>
120
+ * <TagGroup.List>
121
+ * <TagGroup.Tag color="brand">
122
+ * {t("filters.remote")}
123
+ * <TagGroup.Remove name="remove" value="remote" aria-label={t("filters.removeRemote")} />
124
+ * </TagGroup.Tag>
125
+ * </TagGroup.List>
126
+ * </TagGroup>
127
+ * </form>
128
+ */
129
+ TagGroup.Remove = function TagGroupRemove(handle) {
130
+ return () => {
131
+ let { mix, ...rest } = handle.props;
132
+ return (_jsx(Button, { ...rest, type: "submit", variant: "ghost", "data-slot": "remove", mix: [
133
+ mie(-1),
134
+ pb(0.5),
135
+ pi(0.5),
136
+ rounded("full"),
137
+ when("& svg", [is(3), bs(3)]),
138
+ fg("currentColor"),
139
+ hover(bg("brand.bg-tint-hover")),
140
+ when('[data-color="neutral"] &:hover', bg("neutral.bg-tint-hover")),
141
+ when('[data-color="success"] &:hover', bg("success.bg-tint-hover")),
142
+ when('[data-color="danger"] &:hover', bg("danger.bg-tint-hover")),
143
+ when('[data-color="warning"] &:hover', bg("warning.bg-tint-hover")),
144
+ active(bg("brand.bg-tint-pressed")),
145
+ when('[data-color="neutral"] &:active', bg("neutral.bg-tint-pressed")),
146
+ when('[data-color="success"] &:active', bg("success.bg-tint-pressed")),
147
+ when('[data-color="danger"] &:active', bg("danger.bg-tint-pressed")),
148
+ when('[data-color="warning"] &:active', bg("warning.bg-tint-pressed")),
149
+ when("&:focus-visible", outlineColor("brand")),
150
+ when('[data-color="neutral"] &:focus-visible', outlineColor("neutral")),
151
+ when('[data-color="success"] &:focus-visible', outlineColor("success")),
152
+ when('[data-color="danger"] &:focus-visible', outlineColor("danger")),
153
+ when('[data-color="warning"] &:focus-visible', outlineColor("warning")),
154
+ mix,
155
+ ], children: _jsx(XIcon, { size: 12 }) }));
156
+ };
157
+ };
@@ -0,0 +1,119 @@
1
+ /**
2
+ * A convenience wrapper composing a labeled, described, and validated field
3
+ * in one call: a caption through {@link Label}, the control through
4
+ * {@link Input}, an optional supporting passage through {@link Description},
5
+ * and an optional validation message through {@link FieldError}. Every id
6
+ * and `aria-describedby` relationship between the parts is computed from
7
+ * this instance's own stable identifier, leaving no id bookkeeping to the
8
+ * consumer.
9
+ *
10
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
11
+ * @copyright Sergio Xalambrí 2026
12
+ */
13
+ import type { Handle, Props as TagProps, RemixNode } from "remix/ui";
14
+ import type { FieldPartsProps } from "../utils/field-parts.js";
15
+ /**
16
+ * Prop types for {@link TextField}.
17
+ */
18
+ export declare namespace TextField {
19
+ /**
20
+ * Semantic color role for the control's keyboard focus ring, each mapped
21
+ * to its matching `--ui-*` variables.
22
+ */
23
+ type Color = "brand" | "neutral" | "success" | "warning" | "danger";
24
+ /**
25
+ * Native `<input>` `type` this wrapper renders a single-line, text-like
26
+ * control for. A checkbox, radio, or file control each has its own
27
+ * dedicated component instead of a `type` value here.
28
+ */
29
+ type Type = "text" | "email" | "password" | "tel" | "url" | "search" | "number";
30
+ /**
31
+ * Per-part styling for the elements this convenience wrapper composes in
32
+ * one call, layered after each part's own built-in styling.
33
+ */
34
+ type PartsProps = FieldPartsProps;
35
+ /**
36
+ * Props accepted by {@link TextField}. `mix` styles the root element
37
+ * grouping the field's parts; style the composed label, control,
38
+ * description, and error individually through `parts` instead.
39
+ */
40
+ interface Props extends Omit<TagProps<"div">, "children"> {
41
+ /** Semantic color role for the control's focus ring. Defaults to `"neutral"` when omitted. */
42
+ color?: Color;
43
+ /**
44
+ * The field's caption, rendered through {@link Label} and associated
45
+ * with the control through a native `for`/`id` relationship computed
46
+ * from this instance's own identifier.
47
+ */
48
+ label: RemixNode;
49
+ /**
50
+ * Supporting copy rendered through {@link Description} beneath the
51
+ * control and referenced by the control's `aria-describedby`. Omit to
52
+ * render no description.
53
+ */
54
+ description?: RemixNode;
55
+ /**
56
+ * Validation message rendered through {@link FieldError} beneath the
57
+ * control, marking `aria-invalid` unless set explicitly. Falls back to
58
+ * a {@link Form}'s own `issues` message by `name`; an explicit value wins.
59
+ */
60
+ errorMessage?: RemixNode;
61
+ /**
62
+ * Native `autofocus`. Defaults to `true` for the first invalid field of
63
+ * an enclosing {@link Form}'s `issues`, landing keyboard focus on the
64
+ * problem with no client JavaScript; pass explicitly to override.
65
+ */
66
+ autoFocus?: boolean;
67
+ /** Native `<input>` `type`. Defaults to {@link DEFAULT_TYPE}. */
68
+ type?: Type;
69
+ /** Native `name` submitted with an enclosing form. */
70
+ name?: string;
71
+ /** Current value, for a control a consumer tracks itself. */
72
+ value?: string;
73
+ /** Initial value, for a control left to the platform's own uncontrolled state. */
74
+ defaultValue?: string;
75
+ /** Placeholder copy shown while the control is empty. */
76
+ placeholder?: string;
77
+ /** Marks the control required for its enclosing form. */
78
+ required?: boolean;
79
+ /** Marks the control inert and excluded from the tab order. */
80
+ disabled?: boolean;
81
+ /** Marks the control's value fixed, while keeping it focusable and included in form submission. */
82
+ readOnly?: boolean;
83
+ /** Native autofill hint, e.g. `"email"` or `"current-password"`. */
84
+ autoComplete?: string;
85
+ /** Native validation pattern the control's value must match. */
86
+ pattern?: string;
87
+ /** Minimum accepted value length. */
88
+ minLength?: number;
89
+ /** Maximum accepted value length. */
90
+ maxLength?: number;
91
+ /** Per-part styling for this wrapper's internally composed elements. */
92
+ parts?: PartsProps;
93
+ }
94
+ }
95
+ /**
96
+ * Composes {@link Label}, {@link Input}, {@link Description}, and
97
+ * {@link FieldError} into one field, computing every id and
98
+ * `aria-describedby` link from this instance's own stable identifier.
99
+ *
100
+ * @param handle Runtime handle carrying the root element's props and this instance's stable identifier.
101
+ * @returns The render function producing the field's markup.
102
+ * @example
103
+ * <TextField label={t("form.email.label")} type="email" name="email" required />
104
+ * @example
105
+ * <TextField
106
+ * label={t("form.password.label")}
107
+ * type="password"
108
+ * name="password"
109
+ * description={t("form.password.hint")}
110
+ * />
111
+ * @example
112
+ * <TextField
113
+ * label={t("form.username.label")}
114
+ * name="username"
115
+ * defaultValue="ab"
116
+ * errorMessage={t("form.username.tooShort")}
117
+ * />
118
+ */
119
+ export declare function TextField(handle: Handle<TextField.Props>): () => import("remix/ui").RemixElement;
@@ -0,0 +1,51 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "remix/ui/jsx-runtime";
2
+ import { fieldStackLayout } from "../styles/field-stack-layout.js";
3
+ import { resolveFieldWiring } from "../utils/resolve-field-wiring.js";
4
+ import { Description } from "./description.js";
5
+ import { FieldError } from "./field-error.js";
6
+ import { resolveFieldIssue } from "./form.js";
7
+ import { Input } from "./input.js";
8
+ import { Label } from "./label.js";
9
+ /** Native `<input>` `type` {@link TextField} falls back to when `type` is omitted. */
10
+ const DEFAULT_TYPE = "text";
11
+ /**
12
+ * Composes {@link Label}, {@link Input}, {@link Description}, and
13
+ * {@link FieldError} into one field, computing every id and
14
+ * `aria-describedby` link from this instance's own stable identifier.
15
+ *
16
+ * @param handle Runtime handle carrying the root element's props and this instance's stable identifier.
17
+ * @returns The render function producing the field's markup.
18
+ * @example
19
+ * <TextField label={t("form.email.label")} type="email" name="email" required />
20
+ * @example
21
+ * <TextField
22
+ * label={t("form.password.label")}
23
+ * type="password"
24
+ * name="password"
25
+ * description={t("form.password.hint")}
26
+ * />
27
+ * @example
28
+ * <TextField
29
+ * label={t("form.username.label")}
30
+ * name="username"
31
+ * defaultValue="ab"
32
+ * errorMessage={t("form.username.tooShort")}
33
+ * />
34
+ */
35
+ export function TextField(handle) {
36
+ return () => {
37
+ let { color, label, description, errorMessage: errorMessageProp, autoFocus, type, name, value, defaultValue, placeholder, required, disabled, readOnly, autoComplete, pattern, minLength, maxLength, "aria-invalid": ariaInvalidProp, parts, mix, ...rest } = handle.props;
38
+ let resolvedType = type ?? DEFAULT_TYPE;
39
+ let { errorMessage, isFirstInvalid } = resolveFieldIssue(handle, name, errorMessageProp);
40
+ let resolvedAutoFocus = autoFocus ?? (isFirstInvalid || undefined);
41
+ let { resolvedColor, resolvedInvalid, descriptionId, errorId, describedBy } = resolveFieldWiring(handle.id, {
42
+ color,
43
+ errorMessage,
44
+ description,
45
+ ariaInvalid: ariaInvalidProp,
46
+ });
47
+ return (_jsxs("div", { ...rest, "data-slot": "text-field", mix: [fieldStackLayout(), mix], children: [_jsx(Label, { htmlFor: handle.id, mix: parts?.label, children: label }), _jsx(Input, { id: handle.id, type: resolvedType, name: name, value: value, defaultValue: defaultValue, placeholder: placeholder, required: required, disabled: disabled, readOnly: readOnly, autoComplete: autoComplete, pattern: pattern, minLength: minLength, maxLength: maxLength,
48
+ // oxlint-disable-next-line jsx-a11y/no-autofocus -- Not a focus grab on page load: this only ever resolves true for the first field an enclosing Form reports as invalid, so a failed submit lands the user on the problem instead of leaving them to hunt for it.
49
+ autoFocus: resolvedAutoFocus, "aria-invalid": resolvedInvalid, "aria-describedby": describedBy, color: resolvedColor, mix: parts?.input }), description ? (_jsx(Description, { id: descriptionId, mix: parts?.description, children: description })) : null, errorMessage ? (_jsx(FieldError, { id: errorId, mix: parts?.error, children: errorMessage })) : null] }));
50
+ };
51
+ }