@sdxc/ui 2026.11.26 → 2026.11.29

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 (418) hide show
  1. package/README.md +265 -162
  2. package/dist/app/app-shell.d.ts +85 -50
  3. package/dist/app/app-shell.js +419 -222
  4. package/dist/app/auto-refresh.d.ts +68 -51
  5. package/dist/app/auto-refresh.js +193 -61
  6. package/dist/app/board.d.ts +40 -17
  7. package/dist/app/board.js +173 -88
  8. package/dist/app/chart.d.ts +10 -63
  9. package/dist/app/chart.js +22 -29
  10. package/dist/app/code-view.d.ts +12 -11
  11. package/dist/app/code-view.js +83 -19
  12. package/dist/app/command-palette.d.ts +61 -33
  13. package/dist/app/command-palette.js +178 -32
  14. package/dist/app/contribution-graph.d.ts +30 -14
  15. package/dist/app/contribution-graph.js +87 -26
  16. package/dist/app/danger-zone.d.ts +40 -35
  17. package/dist/app/danger-zone.js +177 -34
  18. package/dist/app/detail-sheet.d.ts +42 -51
  19. package/dist/app/detail-sheet.js +156 -37
  20. package/dist/app/diff.d.ts +6 -5
  21. package/dist/app/diff.js +9 -6
  22. package/dist/app/drop-zone.d.ts +3 -13
  23. package/dist/app/drop-zone.js +2 -2
  24. package/dist/app/editor-layout.d.ts +69 -47
  25. package/dist/app/editor-layout.js +256 -115
  26. package/dist/app/empty.d.ts +16 -12
  27. package/dist/app/empty.js +45 -19
  28. package/dist/app/file-trigger.d.ts +5 -13
  29. package/dist/app/file-trigger.js +3 -4
  30. package/dist/app/filter-bar.d.ts +182 -120
  31. package/dist/app/filter-bar.js +509 -161
  32. package/dist/app/filter-menu.d.ts +51 -33
  33. package/dist/app/filter-menu.js +105 -40
  34. package/dist/app/gantt.d.ts +67 -27
  35. package/dist/app/gantt.js +320 -163
  36. package/dist/app/grid-list.d.ts +2 -15
  37. package/dist/app/grid-list.js +3 -3
  38. package/dist/app/merge-box.d.ts +58 -52
  39. package/dist/app/merge-box.js +107 -46
  40. package/dist/app/mixins/optimistic-toggle-sync.d.ts +2 -2
  41. package/dist/app/mixins/optimistic-toggle-sync.js +3 -2
  42. package/dist/app/mixins/range-picker-keys.d.ts +1 -1
  43. package/dist/app/mixins/range-picker-keys.js +1 -1
  44. package/dist/app/mixins/save-bar-sync.d.ts +1 -1
  45. package/dist/app/mixins/save-bar-sync.js +3 -2
  46. package/dist/app/mixins/split-view.d.ts +3 -1
  47. package/dist/app/mixins/split-view.js +16 -8
  48. package/dist/app/optimistic-toggle.d.ts +65 -37
  49. package/dist/app/optimistic-toggle.js +38 -15
  50. package/dist/app/page-header.d.ts +80 -58
  51. package/dist/app/page-header.js +329 -154
  52. package/dist/app/profile-picker.d.ts +31 -24
  53. package/dist/app/profile-picker.js +134 -58
  54. package/dist/app/range-picker.d.ts +62 -59
  55. package/dist/app/range-picker.js +124 -37
  56. package/dist/app/review-thread.d.ts +69 -66
  57. package/dist/app/review-thread.js +203 -53
  58. package/dist/app/save-bar.d.ts +56 -27
  59. package/dist/app/save-bar.js +66 -14
  60. package/dist/app/selection-bar.d.ts +64 -66
  61. package/dist/app/selection-bar.js +157 -56
  62. package/dist/app/settings-layout.d.ts +65 -52
  63. package/dist/app/settings-layout.js +198 -71
  64. package/dist/app/settings-section.d.ts +86 -93
  65. package/dist/app/settings-section.js +297 -120
  66. package/dist/app/shortcut-list.d.ts +19 -8
  67. package/dist/app/shortcut-list.js +50 -9
  68. package/dist/app/sparkline.d.ts +14 -16
  69. package/dist/app/sparkline.js +20 -7
  70. package/dist/app/split-view.d.ts +66 -42
  71. package/dist/app/split-view.js +235 -128
  72. package/dist/app/stat-card.d.ts +16 -4
  73. package/dist/app/stat-card.js +57 -21
  74. package/dist/app/status-strip.d.ts +24 -25
  75. package/dist/app/status-strip.js +82 -25
  76. package/dist/app/tab-bar.d.ts +15 -7
  77. package/dist/app/tab-bar.js +74 -37
  78. package/dist/app/table.d.ts +37 -38
  79. package/dist/app/table.js +101 -45
  80. package/dist/app/view-options.d.ts +100 -76
  81. package/dist/app/view-options.js +263 -129
  82. package/dist/audio/media-tile.d.ts +33 -21
  83. package/dist/audio/media-tile.js +139 -79
  84. package/dist/audio/player-bar.d.ts +24 -43
  85. package/dist/audio/player-bar.js +183 -118
  86. package/dist/audio/queue-list.d.ts +40 -36
  87. package/dist/audio/queue-list.js +172 -73
  88. package/dist/audio/track-list.d.ts +53 -54
  89. package/dist/audio/track-list.js +127 -35
  90. package/dist/blog/archive-list.d.ts +158 -0
  91. package/dist/blog/archive-list.js +353 -0
  92. package/dist/blog/article-layout.d.ts +81 -0
  93. package/dist/blog/article-layout.js +211 -0
  94. package/dist/blog/author-card.d.ts +99 -0
  95. package/dist/blog/author-card.js +184 -0
  96. package/dist/blog/blog-masthead.d.ts +55 -0
  97. package/dist/blog/blog-masthead.js +143 -0
  98. package/dist/blog/index.d.ts +21 -0
  99. package/dist/blog/index.js +21 -0
  100. package/dist/blog/link-host.d.ts +47 -0
  101. package/dist/blog/link-host.js +61 -0
  102. package/dist/blog/newsletter-form.d.ts +66 -0
  103. package/dist/blog/newsletter-form.js +100 -0
  104. package/dist/blog/post-byline.d.ts +96 -0
  105. package/dist/blog/post-byline.js +180 -0
  106. package/dist/blog/post-entry.d.ts +153 -0
  107. package/dist/blog/post-entry.js +402 -0
  108. package/dist/blog/post-stream.d.ts +92 -0
  109. package/dist/blog/post-stream.js +163 -0
  110. package/dist/blog/series-nav.d.ts +144 -0
  111. package/dist/blog/series-nav.js +275 -0
  112. package/dist/blog/tag-cloud.d.ts +103 -0
  113. package/dist/blog/tag-cloud.js +138 -0
  114. package/dist/blog/tag-list.d.ts +91 -0
  115. package/dist/blog/tag-list.js +92 -0
  116. package/dist/blog/widget.d.ts +68 -0
  117. package/dist/blog/widget.js +61 -0
  118. package/dist/chat/activity.d.ts +47 -15
  119. package/dist/chat/activity.js +124 -46
  120. package/dist/chat/mention-menu.d.ts +6 -7
  121. package/dist/chat/mention-menu.js +4 -4
  122. package/dist/chat/message-group.d.ts +17 -4
  123. package/dist/chat/message-group.js +29 -6
  124. package/dist/color/color-field.d.ts +41 -68
  125. package/dist/color/color-field.js +21 -38
  126. package/dist/color/color-picker.d.ts +10 -61
  127. package/dist/color/color-picker.js +7 -15
  128. package/dist/color/color-swatch-picker.d.ts +0 -11
  129. package/dist/color/color-swatch-picker.js +2 -3
  130. package/dist/color/color-wheel.d.ts +3 -13
  131. package/dist/color/color-wheel.js +1 -2
  132. package/dist/commerce/cart-drawer.d.ts +41 -24
  133. package/dist/commerce/cart-drawer.js +129 -58
  134. package/dist/commerce/cart-line.d.ts +34 -19
  135. package/dist/commerce/cart-line.js +94 -28
  136. package/dist/commerce/checkout-layout.d.ts +23 -19
  137. package/dist/commerce/checkout-layout.js +53 -24
  138. package/dist/commerce/facet-filters.d.ts +57 -59
  139. package/dist/commerce/facet-filters.js +219 -129
  140. package/dist/commerce/item-options-dialog.d.ts +69 -40
  141. package/dist/commerce/item-options-dialog.js +231 -104
  142. package/dist/commerce/menu-item-card.d.ts +36 -20
  143. package/dist/commerce/menu-item-card.js +114 -61
  144. package/dist/commerce/option-group.d.ts +46 -27
  145. package/dist/commerce/option-group.js +123 -52
  146. package/dist/commerce/order-summary.d.ts +41 -26
  147. package/dist/commerce/order-summary.js +103 -49
  148. package/dist/commerce/order-tracker.d.ts +32 -16
  149. package/dist/commerce/order-tracker.js +91 -66
  150. package/dist/commerce/price.d.ts +41 -25
  151. package/dist/commerce/price.js +131 -68
  152. package/dist/commerce/product-card.d.ts +66 -36
  153. package/dist/commerce/product-card.js +215 -100
  154. package/dist/commerce/product-gallery.d.ts +72 -38
  155. package/dist/commerce/product-gallery.js +187 -82
  156. package/dist/commerce/promo-code.d.ts +73 -37
  157. package/dist/commerce/promo-code.js +172 -77
  158. package/dist/commerce/question-list.d.ts +43 -35
  159. package/dist/commerce/question-list.js +146 -72
  160. package/dist/commerce/shipping-estimate.d.ts +68 -33
  161. package/dist/commerce/shipping-estimate.js +149 -25
  162. package/dist/commerce/sort-select.d.ts +33 -22
  163. package/dist/commerce/sort-select.js +55 -26
  164. package/dist/commerce/variant-picker.d.ts +25 -23
  165. package/dist/commerce/variant-picker.js +103 -29
  166. package/dist/{docs → components}/anchor-heading.d.ts +1 -1
  167. package/dist/{docs → components}/anchor-heading.js +1 -1
  168. package/dist/components/autocomplete.d.ts +19 -21
  169. package/dist/components/autocomplete.js +57 -21
  170. package/dist/components/banner.d.ts +48 -37
  171. package/dist/components/banner.js +69 -27
  172. package/dist/components/button.d.ts +2 -18
  173. package/dist/components/button.js +4 -3
  174. package/dist/components/callout.d.ts +52 -0
  175. package/dist/components/callout.js +77 -0
  176. package/dist/components/checkbox.d.ts +3 -12
  177. package/dist/components/checkbox.js +1 -2
  178. package/dist/components/code-block.d.ts +110 -0
  179. package/dist/{docs → components}/code-block.js +92 -23
  180. package/dist/components/confirm.d.ts +63 -130
  181. package/dist/components/confirm.js +133 -52
  182. package/dist/{docs → components}/copy-button.d.ts +1 -1
  183. package/dist/{docs → components}/copy-button.js +3 -3
  184. package/dist/components/date-field.d.ts +40 -60
  185. package/dist/components/date-field.js +23 -36
  186. package/dist/components/date-picker.d.ts +11 -67
  187. package/dist/components/date-picker.js +4 -15
  188. package/dist/components/date-range-picker.d.ts +20 -91
  189. package/dist/components/date-range-picker.js +13 -27
  190. package/dist/components/dialog-dismiss.d.ts +1 -1
  191. package/dist/components/dialog-dismiss.js +1 -1
  192. package/dist/components/field-parts.d.ts +158 -0
  193. package/dist/components/field-parts.js +237 -0
  194. package/dist/components/filter-links.d.ts +107 -0
  195. package/dist/components/filter-links.js +120 -0
  196. package/dist/components/form.d.ts +3 -1
  197. package/dist/components/form.js +3 -1
  198. package/dist/components/index.d.ts +14 -7
  199. package/dist/components/index.js +14 -7
  200. package/dist/components/lightbox.js +12 -6
  201. package/dist/components/listbox.d.ts +0 -9
  202. package/dist/components/listbox.js +2 -2
  203. package/dist/components/media-grid.d.ts +15 -16
  204. package/dist/components/media-grid.js +75 -34
  205. package/dist/components/pager.d.ts +103 -0
  206. package/dist/components/pager.js +187 -0
  207. package/dist/components/property-list.d.ts +38 -39
  208. package/dist/components/property-list.js +149 -96
  209. package/dist/components/radio-group.d.ts +0 -11
  210. package/dist/components/radio-group.js +5 -6
  211. package/dist/components/range-calendar.d.ts +2 -14
  212. package/dist/components/range-calendar.js +2 -2
  213. package/dist/components/range-months.d.ts +12 -2
  214. package/dist/components/range-months.js +32 -16
  215. package/dist/components/rating-input.d.ts +14 -6
  216. package/dist/components/rating-input.js +26 -12
  217. package/dist/components/rating.d.ts +13 -8
  218. package/dist/components/rating.js +19 -5
  219. package/dist/components/review-card.d.ts +51 -26
  220. package/dist/components/review-card.js +173 -40
  221. package/dist/components/search-field.js +18 -8
  222. package/dist/components/section-bar.d.ts +23 -15
  223. package/dist/components/section-bar.js +59 -37
  224. package/dist/components/sidebar.d.ts +27 -0
  225. package/dist/components/sidebar.js +49 -20
  226. package/dist/{docs → components}/table-of-contents.d.ts +1 -1
  227. package/dist/{docs → components}/table-of-contents.js +3 -3
  228. package/dist/components/text-field.d.ts +54 -81
  229. package/dist/components/text-field.js +30 -44
  230. package/dist/components/time-field.d.ts +45 -65
  231. package/dist/components/time-field.js +23 -35
  232. package/dist/components/timeline.d.ts +80 -86
  233. package/dist/components/timeline.js +383 -170
  234. package/dist/components/typeset.d.ts +5 -0
  235. package/dist/components/typeset.js +17 -2
  236. package/dist/docs/code-tabs.d.ts +50 -24
  237. package/dist/docs/code-tabs.js +91 -25
  238. package/dist/docs/docs-feedback.d.ts +70 -27
  239. package/dist/docs/docs-feedback.js +156 -27
  240. package/dist/docs/docs-footer.d.ts +36 -22
  241. package/dist/docs/docs-footer.js +76 -23
  242. package/dist/docs/docs-hub.d.ts +103 -73
  243. package/dist/docs/docs-hub.js +333 -83
  244. package/dist/docs/docs-layout.d.ts +111 -42
  245. package/dist/docs/docs-layout.js +371 -97
  246. package/dist/docs/docs-nav-tools.d.ts +11 -7
  247. package/dist/docs/docs-nav-tools.js +4 -3
  248. package/dist/docs/docs-nav.d.ts +53 -17
  249. package/dist/docs/docs-nav.js +125 -14
  250. package/dist/docs/docs-not-found.d.ts +61 -35
  251. package/dist/docs/docs-not-found.js +198 -52
  252. package/dist/docs/docs-page-header.d.ts +47 -30
  253. package/dist/docs/docs-page-header.js +114 -31
  254. package/dist/docs/docs-pager.d.ts +43 -27
  255. package/dist/docs/docs-pager.js +73 -23
  256. package/dist/docs/file-tree.d.ts +16 -6
  257. package/dist/docs/file-tree.js +19 -4
  258. package/dist/docs/index.d.ts +0 -7
  259. package/dist/docs/index.js +0 -7
  260. package/dist/docs/install-command.d.ts +7 -6
  261. package/dist/docs/install-command.js +8 -10
  262. package/dist/docs/mixins/docs-nav-tools.js +1 -1
  263. package/dist/docs/next-steps.d.ts +56 -23
  264. package/dist/docs/next-steps.js +121 -35
  265. package/dist/docs/page-actions.d.ts +68 -46
  266. package/dist/docs/page-actions.js +129 -21
  267. package/dist/docs/steps.d.ts +14 -11
  268. package/dist/docs/steps.js +36 -18
  269. package/dist/docs/ui-label.d.ts +7 -6
  270. package/dist/docs/ui-label.js +21 -8
  271. package/dist/finance/ledger.d.ts +33 -29
  272. package/dist/finance/ledger.js +190 -43
  273. package/dist/finance/payment-card.d.ts +43 -31
  274. package/dist/finance/payment-card.js +170 -67
  275. package/dist/landing/author-band.d.ts +57 -54
  276. package/dist/landing/author-band.js +218 -64
  277. package/dist/landing/case-study.d.ts +57 -57
  278. package/dist/landing/case-study.js +148 -17
  279. package/dist/landing/changelog-strip.d.ts +56 -36
  280. package/dist/landing/changelog-strip.js +176 -68
  281. package/dist/landing/closing-cta.d.ts +21 -41
  282. package/dist/landing/closing-cta.js +13 -19
  283. package/dist/landing/code-stage.d.ts +55 -47
  284. package/dist/landing/code-stage.js +198 -67
  285. package/dist/landing/contributor-wall.d.ts +4 -4
  286. package/dist/landing/contributor-wall.js +4 -4
  287. package/dist/landing/curriculum.d.ts +74 -45
  288. package/dist/landing/curriculum.js +220 -62
  289. package/dist/landing/drawn-chart.d.ts +18 -10
  290. package/dist/landing/drawn-chart.js +57 -26
  291. package/dist/landing/episode-player.d.ts +69 -43
  292. package/dist/landing/episode-player.js +213 -48
  293. package/dist/landing/event-ticker.d.ts +13 -7
  294. package/dist/landing/event-ticker.js +67 -32
  295. package/dist/landing/fan-out-diagram.d.ts +19 -8
  296. package/dist/landing/fan-out-diagram.js +60 -19
  297. package/dist/landing/faq-band.d.ts +30 -48
  298. package/dist/landing/faq-band.js +37 -30
  299. package/dist/landing/feature-band.d.ts +48 -76
  300. package/dist/landing/feature-band.js +71 -49
  301. package/dist/landing/flow-diagram.d.ts +16 -8
  302. package/dist/landing/flow-diagram.js +50 -18
  303. package/dist/landing/install-tabs.d.ts +16 -14
  304. package/dist/landing/install-tabs.js +87 -39
  305. package/dist/landing/landing-header.d.ts +75 -66
  306. package/dist/landing/landing-header.js +284 -57
  307. package/dist/landing/landing-hero.d.ts +59 -87
  308. package/dist/landing/landing-hero.js +157 -128
  309. package/dist/landing/landing-section.d.ts +0 -9
  310. package/dist/landing/landing-section.js +1 -2
  311. package/dist/landing/logo-cloud.d.ts +26 -9
  312. package/dist/landing/logo-cloud.js +62 -18
  313. package/dist/landing/phone-fan.d.ts +15 -7
  314. package/dist/landing/phone-fan.js +60 -17
  315. package/dist/landing/price-list.d.ts +29 -22
  316. package/dist/landing/price-list.js +175 -77
  317. package/dist/landing/pricing-band.d.ts +46 -53
  318. package/dist/landing/pricing-band.js +167 -51
  319. package/dist/landing/product-frame.d.ts +44 -42
  320. package/dist/landing/product-frame.js +182 -85
  321. package/dist/landing/proof-strip.d.ts +7 -2
  322. package/dist/landing/proof-strip.js +7 -2
  323. package/dist/landing/rails.d.ts +1 -1
  324. package/dist/landing/rails.js +1 -1
  325. package/dist/landing/segmented-stage.d.ts +19 -8
  326. package/dist/landing/segmented-stage.js +60 -16
  327. package/dist/landing/sequence-diagram.d.ts +18 -8
  328. package/dist/landing/sequence-diagram.js +49 -18
  329. package/dist/landing/site-footer.d.ts +89 -68
  330. package/dist/landing/site-footer.js +344 -111
  331. package/dist/landing/site-header.d.ts +118 -80
  332. package/dist/landing/site-header.js +482 -67
  333. package/dist/landing/sponsor-wall.d.ts +34 -15
  334. package/dist/landing/sponsor-wall.js +111 -34
  335. package/dist/landing/stat-strip.d.ts +7 -9
  336. package/dist/landing/stat-strip.js +57 -22
  337. package/dist/landing/step-list.d.ts +18 -21
  338. package/dist/landing/step-list.js +132 -38
  339. package/dist/landing/tabbed-stage.d.ts +23 -15
  340. package/dist/landing/tabbed-stage.js +103 -21
  341. package/dist/landing/testimonial-band.d.ts +58 -61
  342. package/dist/landing/testimonial-band.js +209 -71
  343. package/dist/landing/typed-terminal.d.ts +9 -6
  344. package/dist/landing/typed-terminal.js +16 -5
  345. package/dist/landing/usage-estimate.d.ts +83 -74
  346. package/dist/landing/usage-estimate.js +254 -113
  347. package/dist/landing/utils/has-parts.d.ts +17 -0
  348. package/dist/landing/utils/has-parts.js +24 -0
  349. package/dist/map/map-canvas.d.ts +15 -16
  350. package/dist/map/map-canvas.js +40 -24
  351. package/dist/map/map.d.ts +42 -33
  352. package/dist/map/map.js +149 -38
  353. package/dist/mixins/aria-checked.d.ts +1 -4
  354. package/dist/mixins/aria-checked.js +1 -4
  355. package/dist/mixins/clear-field.d.ts +2 -4
  356. package/dist/mixins/clear-field.js +2 -4
  357. package/dist/mixins/index.d.ts +2 -0
  358. package/dist/mixins/index.js +2 -0
  359. package/dist/schedule/agenda.d.ts +69 -41
  360. package/dist/schedule/agenda.js +273 -134
  361. package/dist/schedule/day-strip.d.ts +38 -26
  362. package/dist/schedule/day-strip.js +119 -88
  363. package/dist/test/map.d.ts +1 -1
  364. package/dist/test/map.js +1 -6
  365. package/dist/test/reels.js +1 -1
  366. package/dist/test/stories.js +2 -2
  367. package/dist/travel/boarding-pass.d.ts +94 -70
  368. package/dist/travel/boarding-pass.js +341 -144
  369. package/dist/travel/car-offer.d.ts +109 -49
  370. package/dist/travel/car-offer.js +424 -64
  371. package/dist/travel/fare-options.d.ts +58 -34
  372. package/dist/travel/fare-options.js +210 -69
  373. package/dist/travel/flight-itinerary.d.ts +62 -55
  374. package/dist/travel/flight-itinerary.js +230 -55
  375. package/dist/travel/flight-option.d.ts +65 -33
  376. package/dist/travel/flight-option.js +250 -69
  377. package/dist/travel/flight-segment.d.ts +121 -70
  378. package/dist/travel/flight-segment.js +358 -96
  379. package/dist/travel/package-savings.d.ts +79 -39
  380. package/dist/travel/package-savings.js +309 -65
  381. package/dist/travel/price-breakdown.d.ts +30 -22
  382. package/dist/travel/price-breakdown.js +72 -17
  383. package/dist/travel/rating-breakdown.d.ts +25 -18
  384. package/dist/travel/rating-breakdown.js +60 -23
  385. package/dist/travel/seat-map.d.ts +29 -22
  386. package/dist/travel/seat-map.js +140 -78
  387. package/dist/travel/trip-timeline.d.ts +77 -39
  388. package/dist/travel/trip-timeline.js +316 -107
  389. package/dist/utils/eyebrow.d.ts +2 -2
  390. package/dist/utils/eyebrow.js +3 -3
  391. package/dist/utils/index.d.ts +0 -1
  392. package/dist/utils/index.js +0 -1
  393. package/dist/video/episode-list.d.ts +22 -14
  394. package/dist/video/episode-list.js +89 -53
  395. package/dist/video/reel-feed.d.ts +21 -15
  396. package/dist/video/reel-feed.js +59 -24
  397. package/dist/video/story-viewer.d.ts +6 -5
  398. package/dist/video/story-viewer.js +84 -53
  399. package/dist/video/title-hero.d.ts +8 -8
  400. package/dist/video/title-hero.js +48 -34
  401. package/dist/video/video-card.d.ts +34 -20
  402. package/dist/video/video-card.js +119 -76
  403. package/dist/video/video-player.d.ts +17 -14
  404. package/dist/video/video-player.js +68 -30
  405. package/dist/video/video-shelf.d.ts +26 -14
  406. package/dist/video/video-shelf.js +88 -50
  407. package/package.json +4 -2
  408. package/dist/docs/callout.d.ts +0 -46
  409. package/dist/docs/callout.js +0 -61
  410. package/dist/docs/code-block.d.ts +0 -74
  411. package/dist/utils/field-parts.d.ts +0 -26
  412. package/dist/utils/field-parts.js +0 -12
  413. /package/dist/{docs/mixins → mixins}/copy-feedback.d.ts +0 -0
  414. /package/dist/{docs/mixins → mixins}/copy-feedback.js +0 -0
  415. /package/dist/{docs/mixins → mixins}/toc-spy.d.ts +0 -0
  416. /package/dist/{docs/mixins → mixins}/toc-spy.js +0 -0
  417. /package/dist/{docs/utils → utils}/reveal-in-scroller.d.ts +0 -0
  418. /package/dist/{docs/utils → utils}/reveal-in-scroller.js +0 -0
@@ -8,6 +8,7 @@ import { absolute, hstack, inlineFlex, insBs, insIe, relative, shrink } from "@s
8
8
  import { overflowX } from "@sdxc/u/overflow";
9
9
  import { bs, m, minIs, pi } from "@sdxc/u/size";
10
10
  import { z } from "@sdxc/u/stacking";
11
+ import { when } from "@sdxc/u/state";
11
12
  import { font, text, truncate } from "@sdxc/u/typography";
12
13
  import { COPY_EXCLUDE_ATTRIBUTE } from "../mixins/copy-to-clipboard.js";
13
14
  import { codeLines } from "../utils/code-lines.js";
@@ -50,27 +51,33 @@ const TOKEN_PALETTE = {
50
51
  const FNV_OFFSET = 0x811c9dc5;
51
52
  /** FNV-1a prime, which spreads each character through the hash. */
52
53
  const FNV_PRIME = 0x01000193;
54
+ /** The marker attribute the card's layout selects its floating copy button by. */
55
+ const PART = "data-code-block-part";
53
56
  /**
54
- * Renders the card: a header naming the file (or the language) with the copy button, and
55
- * the code, which scrolls sideways inside the card. Marked lines tint across the full
57
+ * Renders the card: the parts it holds (or a header naming the language with the copy button),
58
+ * then the code, which scrolls sideways inside the card. Marked lines tint across the full
56
59
  * scroll width with a 2px bar whose width comes out of the line's padding, so no text moves.
57
60
  *
58
61
  * @param handle Runtime handle carrying the block's props.
59
62
  * @returns The render function producing the card.
60
63
  * @example
61
- * <CodeBlock title="vite.config.ts" language="ts" code={source} highlight={[4, 5]} labels={{ copy: t("copy"), copied: t("copied") }} />
64
+ * <CodeBlock language="ts" code={source} highlight={[4, 5]} labels={{ copy: t("copy"), copied: t("copied") }}>
65
+ * <CodeBlock.Header>
66
+ * <CodeBlock.Title>vite.config.ts</CodeBlock.Title>
67
+ * <CodeBlock.Copy />
68
+ * </CodeBlock.Header>
69
+ * </CodeBlock>
62
70
  * @example
63
- * <CodeBlock title="Terminal" language="sh" code={"$ npm add @sdxc/ui\n$ npm run dev"} labels={labels} />
71
+ * <CodeBlock language="sh" code={"$ npm add @sdxc/ui"} labels={labels} />
64
72
  */
65
73
  export function CodeBlock(handle) {
66
74
  return () => {
67
- let { add, code, codeId, highlight, labels, language, lineNumbers = false, mix, remove, title, tokens, ...rest } = handle.props;
68
- let shell = isShell(language, title);
75
+ let { add, children, code, codeId, highlight, labels, language, lineNumbers = false, mix, remove, tokens, ...rest } = handle.props;
76
+ let shell = isShell(language);
69
77
  let lines = paintLines(code, language, tokens, shell, { add, highlight, remove });
70
78
  let id = codeId ?? stableId(code);
71
- let heading = title ?? (language && language !== "plain" ? language : undefined);
72
- let copy = _jsx(CopyButton, { target: id, label: labels.copy, copiedLabel: labels.copied });
73
79
  let digits = Math.max(2, String(lines.length).length);
80
+ handle.context.set({ codeId: id, labels, shell });
74
81
  return (_jsxs("figure", { ...rest, "data-slot": "code-block", "data-language": language, mix: mergeMix([
75
82
  relative(),
76
83
  m(0),
@@ -79,12 +86,8 @@ export function CodeBlock(handle) {
79
86
  border({ color: "neutral.border", width: 1, style: "solid" }),
80
87
  bg("neutral.bg-tint"),
81
88
  raw({ overflow: "hidden" }),
82
- ], mix), children: [heading ? (_jsxs("figcaption", { mix: [
83
- hstack({ gap: 2, align: "center", justify: "between" }),
84
- bs("2.5rem"),
85
- pi(4, 1),
86
- borderEdge("block-end", { color: "neutral.border", width: 1, style: "solid" }),
87
- ], children: [_jsxs("span", { mix: [hstack({ gap: 2, align: "center" }), minIs(0), fg("neutral")], children: [_jsx("span", { "data-slot": "code-block-icon", mix: [inlineFlex(), shrink(0)], children: _jsx(TitleIcon, { title: title, shell: shell }) }), _jsx("span", { mix: [minIs(0), truncate(), title && isPath(title) ? font("mono") : [], text("xs")], children: heading })] }), copy] })) : (_jsx("span", { mix: [absolute(), insBs("0.375rem"), insIe("0.375rem"), z(1)], children: copy })), _jsx("pre", { "data-not-typeset": "", "data-line-numbers": lineNumbers ? "" : undefined, mix: [
89
+ when(`&:has(> [${PART}=copy])`, raw({ "--ui-code-block-line-end": "3rem" })),
90
+ ], mix), children: [children ?? _jsx(DefaultHeader, { language: language }), _jsx("pre", { "data-not-typeset": "", "data-line-numbers": lineNumbers ? "" : undefined, mix: [
88
91
  m(0),
89
92
  overflowX("auto"),
90
93
  fg("neutral.emphasis"),
@@ -101,20 +104,88 @@ export function CodeBlock(handle) {
101
104
  tabSize: 4,
102
105
  overscrollBehaviorInline: "contain",
103
106
  }),
104
- ], children: _jsx("code", { id: id, className: language ? `language-${language}` : undefined, mix: [lineRules(Boolean(heading), lineNumbers, digits)], children: renderLines(lines) }) })] }));
107
+ ], children: _jsx("code", { id: id, className: language ? `language-${language}` : undefined, mix: [lineRules(lineNumbers, digits)], children: renderLines(lines) }) })] }));
105
108
  };
106
109
  }
110
+ /**
111
+ * What a card with no parts draws: a header naming its language with the copy button, or the
112
+ * copy button floating over the code when the block names no language.
113
+ *
114
+ * @param handle Runtime handle carrying the block's language.
115
+ * @returns The render function producing the header or the floating button.
116
+ */
117
+ function DefaultHeader(handle) {
118
+ return () => {
119
+ let { language } = handle.props;
120
+ if (!language || language === "plain")
121
+ return _jsx(CodeBlock.Copy, {});
122
+ return (_jsxs(CodeBlock.Header, { children: [_jsx(CodeBlock.Title, { children: language }), _jsx(CodeBlock.Copy, {})] }));
123
+ };
124
+ }
125
+ /**
126
+ * The header row over the code, holding a {@link CodeBlock.Title} at its start and a
127
+ * {@link CodeBlock.Copy} at its end.
128
+ *
129
+ * @param handle Runtime handle carrying the host `<figcaption>`'s props.
130
+ * @returns The render function producing the header.
131
+ */
132
+ CodeBlock.Header = function CodeBlockHeader(handle) {
133
+ return () => {
134
+ let { mix, ...rest } = handle.props;
135
+ handle.context.set({ inHeader: true });
136
+ return (_jsx("figcaption", { "data-slot": "code-block-header", ...rest, mix: mergeMix([
137
+ hstack({ gap: 2, align: "center", justify: "between" }),
138
+ bs("2.5rem"),
139
+ pi(4, 1),
140
+ borderEdge("block-end", { color: "neutral.border", width: 1, style: "solid" }),
141
+ ], mix) }));
142
+ };
143
+ };
144
+ /**
145
+ * What the header reads as, after an icon for its kind: a file path in the mono face, or any
146
+ * other words (such as "Terminal") as written, truncated to one line.
147
+ *
148
+ * @param handle Runtime handle carrying the host `<span>`'s props.
149
+ * @returns The render function producing the title.
150
+ * @example <CodeBlock.Title>app/routes.ts</CodeBlock.Title>
151
+ */
152
+ CodeBlock.Title = function CodeBlockTitle(handle) {
153
+ return () => {
154
+ let { children, mix, ...rest } = handle.props;
155
+ let context = handle.context.get(CodeBlock);
156
+ let title = typeof children === "string" ? children : undefined;
157
+ let shell = (context?.shell ?? false) || title?.trim().toLowerCase() === "terminal";
158
+ return (_jsxs("span", { "data-slot": "code-block-title", ...rest, mix: mergeMix([hstack({ gap: 2, align: "center" }), minIs(0), fg("neutral")], mix), children: [_jsx("span", { "data-slot": "code-block-icon", mix: [inlineFlex(), shrink(0)], children: _jsx(TitleIcon, { title: title, shell: shell }) }), _jsx("span", { mix: [minIs(0), truncate(), title && isPath(title) ? font("mono") : [], text("xs")], children: children })] }));
159
+ };
160
+ };
161
+ /**
162
+ * The copy button, which copies what a reader should paste: at a header's end, or floating over
163
+ * the code's top corner when written directly in the card.
164
+ *
165
+ * @param handle Runtime handle carrying the button box's props.
166
+ * @returns The render function producing the button.
167
+ */
168
+ CodeBlock.Copy = function CodeBlockCopy(handle) {
169
+ return () => {
170
+ let { mix, ...rest } = handle.props;
171
+ let context = handle.context.get(CodeBlock);
172
+ let header = handle.context.get(CodeBlock.Header);
173
+ let labels = context?.labels;
174
+ return (_jsx("span", { "data-slot": "code-block-copy", ...rest, "data-code-block-part": "copy", mix: mergeMix(header ? [inlineFlex()] : [absolute(), insBs("0.375rem"), insIe("0.375rem"), z(1)], mix), children: _jsx(CopyButton, { target: context?.codeId ?? "", label: labels?.copy ?? "", copiedLabel: labels?.copied ?? "" }) }));
175
+ };
176
+ };
107
177
  /**
108
178
  * Every rule the lines follow, in one block so a marked line's padding, bar and tint
109
179
  * resolve by specificity alone. The grid makes each line as wide as the longest one, so a
110
180
  * tint runs the full scroll width, and drops the newlines between lines from layout while
111
181
  * leaving them in the text a copy reads.
112
182
  *
113
- * @param hasHeader Whether the copy button sits in a header rather than over the code.
183
+ * Lines end on `--ui-code-block-line-end`, which a card with a floating copy button widens.
184
+ *
114
185
  * @param lineNumbers Whether lines draw a gutter number.
115
186
  * @param digits Digits the widest line number needs.
116
187
  */
117
- function lineRules(hasHeader, lineNumbers, digits) {
188
+ function lineRules(lineNumbers, digits) {
118
189
  let markedInset = `calc(${LINE_INSET} - ${MARK_BAR})`;
119
190
  let tint = (tone) => `color-mix(in oklab, var(--ui-${tone}-fg) 12%, transparent)`;
120
191
  return raw({
@@ -129,7 +200,7 @@ function lineRules(hasHeader, lineNumbers, digits) {
129
200
  position: "relative",
130
201
  minBlockSize: "1lh",
131
202
  paddingInlineStart: LINE_INSET,
132
- paddingInlineEnd: hasHeader ? LINE_INSET : "3rem",
203
+ paddingInlineEnd: `var(--ui-code-block-line-end, ${LINE_INSET})`,
133
204
  counterIncrement: "line",
134
205
  },
135
206
  "& > [data-mark]": {
@@ -197,11 +268,9 @@ function TitleIcon(handle) {
197
268
  function isPath(title) {
198
269
  return /[/.]/.test(title) && !/\s/.test(title);
199
270
  }
200
- /** Whether the block is a shell session, by its language or a "Terminal" title. */
201
- function isShell(language, title) {
202
- if (language && SHELL_LANGUAGES.has(language.toLowerCase()))
203
- return true;
204
- return title?.trim().toLowerCase() === "terminal";
271
+ /** Whether the block is a shell session, by its language. */
272
+ function isShell(language) {
273
+ return Boolean(language && SHELL_LANGUAGES.has(language.toLowerCase()));
205
274
  }
206
275
  /**
207
276
  * Splits the code into lines, each holding its runs and its mark. In a shell block a
@@ -1,155 +1,89 @@
1
1
  /**
2
- * A convenience wrapper composing a two-control confirmation prompt in one
3
- * call: an {@link AlertDialog} panel prefilled with a heading, an optional
4
- * supporting passage, and a cancel/confirm control pair, so a single
5
- * consequential decision needs no compound assembly of its own. The
6
- * confirming control defaults to the semantic danger tone, and a
7
- * type-to-confirm variant holds a big irreversible action until its name is typed.
2
+ * A confirmation prompt built from parts over {@link AlertDialog}: the root wires the
3
+ * heading and description ids and the panel's `id` into every control, a `.Form` turns
4
+ * confirming into a real submission, and a `.Phrase` holds a big irreversible action
5
+ * until its name is typed. The confirming control defaults to the danger tone.
8
6
  *
9
7
  * @author [Sergio Xalambrí](https://sergiodxa.com)
10
8
  * @copyright Sergio Xalambrí 2026
11
9
  */
12
- import type { EntryComponent, Handle, Props as TagProps, RemixNode } from "remix/component";
10
+ import type { EntryComponent, Handle, Props as TagProps } from "remix/component";
13
11
  import type { Button } from "./button.js";
14
12
  import { AlertDialog } from "./alert-dialog.js";
15
13
  /**
16
- * Prop types for {@link Confirm}.
14
+ * Prop types for {@link Confirm} and its parts.
17
15
  */
18
16
  export declare namespace Confirm {
19
- /**
20
- * Per-part styling for the elements this convenience wrapper composes in
21
- * one call, layered after each part's own built-in styling.
22
- */
23
- interface PartsProps {
24
- /** Styling for the header slot wrapping the title and description, rendered through {@link AlertDialog.Header}. */
25
- header?: TagProps<"div">["mix"];
26
- /** Styling for the heading, rendered through {@link AlertDialog.Title}, whichever heading tag its ambient level resolves to. */
27
- title?: TagProps<"h1" | "h2" | "h3" | "h4" | "h5" | "h6">["mix"];
28
- /** Styling for the supporting description, rendered through {@link AlertDialog.Description} only when `description` is set. */
29
- description?: TagProps<"p">["mix"];
30
- /** Styling for the action row wrapping the cancel and confirm controls, rendered through {@link AlertDialog.Footer}. */
31
- footer?: TagProps<"div">["mix"];
32
- /** Styling for the control that backs out without confirming, rendered through {@link AlertDialog.Cancel}. */
33
- cancel?: TagProps<"button">["mix"];
34
- /** Styling for the confirming control, rendered through {@link AlertDialog.Action}. */
35
- action?: TagProps<"button">["mix"];
36
- /** Styling for the `<form>` wrapping the panel's content, rendered only in submit mode. */
37
- form?: TagProps<"form">["mix"];
17
+ /** What the root shares with its parts. */
18
+ interface Context {
19
+ /** The panel's `id`, which Cancel and Action close. */
20
+ id: string;
21
+ color: Button.Color;
22
+ /** The id {@link Confirm.Title} takes, which names the panel. */
23
+ titleId: string;
24
+ /** The id {@link Confirm.Description} takes, which describes the panel. */
25
+ descriptionId: string;
26
+ /** The id the phrase field takes. */
27
+ phraseId: string;
28
+ }
29
+ /** What a {@link Confirm.Form} shares with the confirming control. */
30
+ interface FormContext {
31
+ submits: true;
38
32
  }
39
33
  /**
40
- * The submission a confirming control performs instead of merely closing
41
- * the panel. Passing this switches {@link Confirm} into submit mode, where
42
- * the form's response is what ends the interruption.
34
+ * Every {@link AlertDialog} attribute, with a required `id` a trigger elsewhere targets
35
+ * through `commandfor`/`command="show-modal"`, plus the confirming control's colour.
43
36
  */
44
- interface FormProps {
45
- /** URL the confirmation submits to. Omit to submit to the current URL, as a native `<form>` with no `action` does. */
46
- action?: string;
47
- /** HTTP method the confirmation submits with. Defaults to {@link DEFAULT_METHOD}, since a confirmed action changes state. */
37
+ interface Props extends Omit<AlertDialog.Props, "id"> {
38
+ id: string;
39
+ /** @default {@link DEFAULT_COLOR} */
40
+ color?: Button.Color;
41
+ }
42
+ /** Every native `<form>` attribute; `method` defaults to `"post"`, since a confirmed action changes state. */
43
+ interface FormProps extends Omit<TagProps<"form">, "method"> {
48
44
  method?: "get" | "post";
49
- /**
50
- * Hidden inputs submitted along with the confirmation — a CSRF token,
51
- * an intent discriminator, the id of the record being acted on. They
52
- * render first inside the form, before the panel's own content.
53
- */
54
- fields?: RemixNode;
55
45
  }
56
- /**
57
- * The phrase a person types before a big irreversible action unlocks, such as
58
- * the team's name. Reserve it for deleting something large; on routine
59
- * confirms it reads as melodrama.
60
- */
61
- interface TypeToConfirm {
46
+ /** Every native `<input>` attribute's essentials for the phrase field, and its label as children. */
47
+ interface PhraseProps extends Omit<TagProps<"div">, "children"> {
62
48
  /** The exact text that unlocks the confirming control, compared case-sensitively. */
63
49
  value: string;
64
- /** The field's label, such as `Type "acme" to confirm`. */
65
- label: RemixNode;
66
- /** Name the typed text submits under in submit mode, so the server can check it again. */
50
+ /** Name the typed text submits under inside a {@link Confirm.Form}, so the server can check it again. */
67
51
  name?: string;
68
- }
69
- /**
70
- * Props accepted by {@link Confirm}. `mix` styles the underlying
71
- * {@link AlertDialog} host directly; style the composed header, title,
72
- * description, footer, and controls individually through `parts` instead.
73
- */
74
- interface Props extends Omit<AlertDialog.Props, "id" | "children" | "title"> {
75
- /**
76
- * Stable identifier the panel renders as its own `id`; a trigger
77
- * elsewhere on the page targets it via `commandfor`/`command="show-modal"`,
78
- * and the cancel and confirm controls point back at it automatically.
79
- */
80
- id: string;
81
- /** The panel's heading, rendered through {@link AlertDialog.Title}. */
82
- title: RemixNode;
83
- /**
84
- * Supporting copy rendered through {@link AlertDialog.Description}
85
- * beneath the title. Omit to render no description.
86
- */
87
- description?: RemixNode;
88
- /** Label for the confirming control, rendered through {@link AlertDialog.Action}. */
89
- confirmLabel: RemixNode;
90
- /** Label for the control that backs out without confirming, rendered through {@link AlertDialog.Cancel}. */
91
- cancelLabel: RemixNode;
92
- /** Semantic color for the confirming control. Defaults to {@link DEFAULT_COLOR}. */
93
- color?: Button.Color;
94
- /**
95
- * Submission the confirming control performs. Omitting it leaves
96
- * confirming as a close-only action for the page to react to; setting it
97
- * submits a real form instead.
98
- */
99
- form?: FormProps;
100
- /**
101
- * Holds the confirming control disabled until this phrase is typed. Without
102
- * script the field's `pattern` blocks the submission instead.
103
- */
104
- typeToConfirm?: TypeToConfirm;
105
- /** Per-part styling for this wrapper's internally composed elements. */
106
- parts?: PartsProps;
52
+ /** The field's label, such as `Type "acme" to confirm`. */
53
+ children: TagProps<"label">["children"];
107
54
  }
108
55
  }
109
56
  /**
110
- * Composes {@link AlertDialog} into a confirmation prompt, wiring title and
111
- * description ids to `aria-labelledby`/`aria-describedby`. Focus opens on Cancel, or
112
- * on the phrase field with `typeToConfirm`; pass `form` to submit a real `<form>`.
57
+ * Renders the {@link AlertDialog} panel, named by its {@link Confirm.Title} and described by its
58
+ * {@link Confirm.Description} through generated ids. Focus opens on {@link Confirm.Cancel}, or on
59
+ * a {@link Confirm.Phrase} field, which comes first in the panel.
113
60
  *
114
61
  * @param handle Runtime handle carrying the panel's props and this instance's stable identifier.
115
- * @returns The render function producing the confirmation prompt's markup.
62
+ * @returns The render function producing the panel.
116
63
  * @example
117
- * <Button commandfor="confirm-delete" command="show-modal" color="danger">{t("project.delete")}</Button>
118
- * <Confirm
119
- * id="confirm-delete"
120
- * title={t("project.deleteTitle")}
121
- * description={t("project.deleteDescription")}
122
- * confirmLabel={t("actions.delete")}
123
- * cancelLabel={t("actions.cancel")}
124
- * />
125
- * @example
126
- * <Confirm
127
- * id="publish-post"
128
- * title={t("post.publishTitle")}
129
- * confirmLabel={t("actions.publish")}
130
- * cancelLabel={t("actions.cancel")}
131
- * color="brand"
132
- * />
133
- * @example
134
- * <Confirm
135
- * id="revoke-session"
136
- * title={t("session.revokeTitle")}
137
- * confirmLabel={t("actions.revoke")}
138
- * cancelLabel={t("actions.cancel")}
139
- * form={{ action: revokeUrl, fields: <input type="hidden" name="csrf" value={token} /> }}
140
- * />
141
- * @example
142
- * <Confirm
143
- * id="delete-team"
144
- * title="Delete team?"
145
- * description="Acme, its 12 monitors and their history are deleted."
146
- * confirmLabel="Delete team"
147
- * cancelLabel="Cancel"
148
- * typeToConfirm={{ value: "acme", label: 'Type "acme" to confirm', name: "confirmation" }}
149
- * form={{ action: "/teams/acme/delete" }}
150
- * />
64
+ * <Button commandfor="confirm-delete" command="show-modal" color="danger">Delete project</Button>
65
+ * <Confirm id="confirm-delete">
66
+ * <Confirm.Header>
67
+ * <Confirm.Title>Delete project?</Confirm.Title>
68
+ * <Confirm.Description>Its monitors and their history are deleted.</Confirm.Description>
69
+ * </Confirm.Header>
70
+ * <Confirm.Footer>
71
+ * <Confirm.Cancel>Cancel</Confirm.Cancel>
72
+ * <Confirm.Action>Delete</Confirm.Action>
73
+ * </Confirm.Footer>
74
+ * </Confirm>
151
75
  */
152
- export declare function Confirm(handle: Handle<Confirm.Props>): () => import("remix/component").RemixElement;
76
+ export declare function Confirm(handle: Handle<Confirm.Props, Confirm.Context>): () => import("remix/component").RemixElement;
77
+ export declare namespace Confirm {
78
+ var Form: (handle: Handle<Confirm.FormProps, Confirm.FormContext>) => () => import("remix/component").RemixElement;
79
+ var Header: (handle: Handle<AlertDialog.HeaderProps>) => () => import("remix/component").RemixElement;
80
+ var Title: (handle: Handle<AlertDialog.TitleProps>) => () => import("remix/component").RemixElement;
81
+ var Description: (handle: Handle<AlertDialog.DescriptionProps>) => () => import("remix/component").RemixElement;
82
+ var Phrase: (handle: Handle<Confirm.PhraseProps>) => () => import("remix/component").RemixElement;
83
+ var Footer: (handle: Handle<AlertDialog.FooterProps>) => () => import("remix/component").RemixElement;
84
+ var Cancel: (handle: Handle<Omit<AlertDialog.CancelProps, "commandfor">>) => () => import("remix/component").RemixElement;
85
+ var Action: (handle: Handle<Omit<AlertDialog.ActionProps, "commandfor">>) => () => import("remix/component").RemixElement;
86
+ }
153
87
  /**
154
88
  * Props {@link ConfirmPhrase} serializes into the page for hydration, which is why they are
155
89
  * a `type`: `SerializableProps` rejects an interface.
@@ -159,15 +93,14 @@ export type ConfirmPhraseProps = {
159
93
  id: string;
160
94
  /** The exact text that unlocks the confirming control. */
161
95
  value: string;
162
- label: RemixNode;
163
96
  name?: string;
164
97
  };
165
98
  /**
166
- * Client island: the field a type-to-confirm prompt holds. It disables the dialog's
99
+ * Client island: the input a type-to-confirm prompt holds. It disables the dialog's
167
100
  * confirming control until the typed text matches and clears itself when the dialog
168
101
  * closes, so every opening starts locked; without script, `pattern` blocks the submit.
169
102
  *
170
103
  * @example
171
- * <ConfirmPhrase id="delete-team-phrase" value="acme" label='Type "acme" to confirm' />
104
+ * <ConfirmPhrase id="delete-team-phrase" value="acme" />
172
105
  */
173
106
  export declare const ConfirmPhrase: EntryComponent<ConfirmPhraseProps>;
@@ -1,4 +1,5 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "remix/component/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
2
+ import { mergeMix } from "@sdxc/u/general";
2
3
  import { flex, flexCol, gap, vstack } from "@sdxc/u/layout";
3
4
  import { clientEntry } from "remix/component";
4
5
  import { confirmPhrase } from "../mixins/confirm-phrase.js";
@@ -7,69 +8,149 @@ import { Input } from "./input.js";
7
8
  import { Label } from "./label.js";
8
9
  /** Semantic color role {@link Confirm} falls back to when `color` is omitted. */
9
10
  const DEFAULT_COLOR = "danger";
10
- /** HTTP method a submitting {@link Confirm} falls back to when `form.method` is omitted. */
11
+ /** HTTP method a {@link Confirm.Form} falls back to when `method` is omitted. */
11
12
  const DEFAULT_METHOD = "post";
12
13
  /**
13
- * Column gap the wrapping `<form>` re-declares in submit mode, matching the
14
- * panel's own child gap — the form becomes the panel's single child, so
15
- * without this the header and footer would lose their spacing.
14
+ * Column gap the form re-declares, matching the panel's own child gap: the form becomes
15
+ * the panel's single child, so without it the header and footer would lose their spacing.
16
16
  */
17
17
  const PANEL_GAP = 6;
18
18
  /** Characters a `pattern` (compiled with the `v` flag) reads as syntax, escaped to match literally. */
19
19
  const PATTERN_SYNTAX = /[\\^$.*+?()[\]{}|/]/g;
20
20
  /**
21
- * Composes {@link AlertDialog} into a confirmation prompt, wiring title and
22
- * description ids to `aria-labelledby`/`aria-describedby`. Focus opens on Cancel, or
23
- * on the phrase field with `typeToConfirm`; pass `form` to submit a real `<form>`.
21
+ * Renders the {@link AlertDialog} panel, named by its {@link Confirm.Title} and described by its
22
+ * {@link Confirm.Description} through generated ids. Focus opens on {@link Confirm.Cancel}, or on
23
+ * a {@link Confirm.Phrase} field, which comes first in the panel.
24
24
  *
25
25
  * @param handle Runtime handle carrying the panel's props and this instance's stable identifier.
26
- * @returns The render function producing the confirmation prompt's markup.
26
+ * @returns The render function producing the panel.
27
27
  * @example
28
- * <Button commandfor="confirm-delete" command="show-modal" color="danger">{t("project.delete")}</Button>
29
- * <Confirm
30
- * id="confirm-delete"
31
- * title={t("project.deleteTitle")}
32
- * description={t("project.deleteDescription")}
33
- * confirmLabel={t("actions.delete")}
34
- * cancelLabel={t("actions.cancel")}
35
- * />
36
- * @example
37
- * <Confirm
38
- * id="publish-post"
39
- * title={t("post.publishTitle")}
40
- * confirmLabel={t("actions.publish")}
41
- * cancelLabel={t("actions.cancel")}
42
- * color="brand"
43
- * />
44
- * @example
45
- * <Confirm
46
- * id="revoke-session"
47
- * title={t("session.revokeTitle")}
48
- * confirmLabel={t("actions.revoke")}
49
- * cancelLabel={t("actions.cancel")}
50
- * form={{ action: revokeUrl, fields: <input type="hidden" name="csrf" value={token} /> }}
51
- * />
52
- * @example
53
- * <Confirm
54
- * id="delete-team"
55
- * title="Delete team?"
56
- * description="Acme, its 12 monitors and their history are deleted."
57
- * confirmLabel="Delete team"
58
- * cancelLabel="Cancel"
59
- * typeToConfirm={{ value: "acme", label: 'Type "acme" to confirm', name: "confirmation" }}
60
- * form={{ action: "/teams/acme/delete" }}
61
- * />
28
+ * <Button commandfor="confirm-delete" command="show-modal" color="danger">Delete project</Button>
29
+ * <Confirm id="confirm-delete">
30
+ * <Confirm.Header>
31
+ * <Confirm.Title>Delete project?</Confirm.Title>
32
+ * <Confirm.Description>Its monitors and their history are deleted.</Confirm.Description>
33
+ * </Confirm.Header>
34
+ * <Confirm.Footer>
35
+ * <Confirm.Cancel>Cancel</Confirm.Cancel>
36
+ * <Confirm.Action>Delete</Confirm.Action>
37
+ * </Confirm.Footer>
38
+ * </Confirm>
62
39
  */
63
40
  export function Confirm(handle) {
64
41
  return () => {
65
- let { id, title, description, confirmLabel, cancelLabel, color, form, typeToConfirm, "aria-labelledby": ariaLabelledByProp, "aria-describedby": ariaDescribedByProp, parts, mix, ...rest } = handle.props;
66
- let resolvedColor = color ?? DEFAULT_COLOR;
42
+ let { id, color = DEFAULT_COLOR, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, ...rest } = handle.props;
67
43
  let titleId = `${handle.id}-title`;
68
- let descriptionId = description ? `${handle.id}-description` : undefined;
69
- let content = (_jsxs(_Fragment, { children: [_jsxs(AlertDialog.Header, { mix: parts?.header, children: [_jsx(AlertDialog.Title, { id: titleId, mix: parts?.title, children: title }), description ? (_jsx(AlertDialog.Description, { id: descriptionId, mix: parts?.description, children: description })) : null] }), typeToConfirm ? (_jsx(ConfirmPhrase, { id: `${handle.id}-phrase`, value: typeToConfirm.value, label: typeToConfirm.label, name: typeToConfirm.name })) : null, _jsxs(AlertDialog.Footer, { mix: parts?.footer, children: [_jsx(AlertDialog.Cancel, { commandfor: id, autofocus: typeToConfirm ? undefined : true, mix: parts?.cancel, children: cancelLabel }), _jsx(AlertDialog.Action, { "data-confirm-action": "", type: form ? "submit" : undefined, commandfor: form ? undefined : id, color: resolvedColor, mix: parts?.action, children: confirmLabel })] })] }));
70
- return (_jsx(AlertDialog, { ...rest, id: id, "aria-labelledby": ariaLabelledByProp ?? titleId, "aria-describedby": ariaDescribedByProp ?? descriptionId, mix: mix, children: form ? (_jsxs("form", { action: form.action, method: form.method ?? DEFAULT_METHOD, mix: [flex(), flexCol(), gap(PANEL_GAP), parts?.form], children: [form.fields, content] })) : (content) }));
44
+ let descriptionId = `${handle.id}-description`;
45
+ handle.context.set({ id, color, titleId, descriptionId, phraseId: `${handle.id}-phrase` });
46
+ return (_jsx(AlertDialog, { ...rest, id: id, "aria-labelledby": ariaLabelledBy ?? titleId, "aria-describedby": ariaDescribedBy ?? descriptionId }));
71
47
  };
72
48
  }
49
+ /**
50
+ * Turns confirming into a real submission: the panel's parts go inside, the confirming control
51
+ * becomes its submit button, and hidden inputs (a CSRF token, the record's id) go in as children.
52
+ *
53
+ * @param handle Runtime handle carrying the host `<form>`'s props.
54
+ * @returns The render function producing the form.
55
+ * @example
56
+ * <Confirm.Form action={revokeUrl}>
57
+ * <input type="hidden" name="csrf" value={token} />
58
+ * <Confirm.Header><Confirm.Title>Revoke this session?</Confirm.Title></Confirm.Header>
59
+ * <Confirm.Footer><Confirm.Cancel>Cancel</Confirm.Cancel><Confirm.Action>Revoke</Confirm.Action></Confirm.Footer>
60
+ * </Confirm.Form>
61
+ */
62
+ Confirm.Form = function ConfirmForm(handle) {
63
+ return () => {
64
+ let { method = DEFAULT_METHOD, mix, ...rest } = handle.props;
65
+ handle.context.set({ submits: true });
66
+ return (_jsx("form", { "data-slot": "confirm-form", ...rest, method: method, mix: mergeMix([flex(), flexCol(), gap(PANEL_GAP)], mix) }));
67
+ };
68
+ };
69
+ /**
70
+ * The column stacking the title and description.
71
+ *
72
+ * @param handle Runtime handle carrying the host `<div>`'s props.
73
+ * @returns The render function producing the header.
74
+ */
75
+ Confirm.Header = function ConfirmHeader(handle) {
76
+ return () => _jsx(AlertDialog.Header, { ...handle.props });
77
+ };
78
+ /**
79
+ * The panel's heading, which names it.
80
+ *
81
+ * @param handle Runtime handle carrying the heading's props.
82
+ * @returns The render function producing the heading.
83
+ */
84
+ Confirm.Title = function ConfirmTitle(handle) {
85
+ return () => {
86
+ let context = handle.context.get(Confirm);
87
+ return _jsx(AlertDialog.Title, { id: context?.titleId, ...handle.props });
88
+ };
89
+ };
90
+ /**
91
+ * The supporting copy under the title, which describes the panel.
92
+ *
93
+ * @param handle Runtime handle carrying the host `<p>`'s props.
94
+ * @returns The render function producing the description.
95
+ */
96
+ Confirm.Description = function ConfirmDescription(handle) {
97
+ return () => {
98
+ let context = handle.context.get(Confirm);
99
+ return _jsx(AlertDialog.Description, { id: context?.descriptionId, ...handle.props });
100
+ };
101
+ };
102
+ /**
103
+ * The type-to-confirm field: its label, then an input that keeps the confirming control
104
+ * disabled until the phrase matches. Reserve it for deleting something large.
105
+ *
106
+ * @param handle Runtime handle carrying the wrapper's props, the phrase and the label.
107
+ * @returns The render function producing the field.
108
+ * @example <Confirm.Phrase value="acme" name="confirmation">Type "acme" to confirm</Confirm.Phrase>
109
+ */
110
+ Confirm.Phrase = function ConfirmPhraseField(handle) {
111
+ return () => {
112
+ let { value, name, children, mix, ...rest } = handle.props;
113
+ let context = handle.context.get(Confirm);
114
+ let id = context?.phraseId ?? `${handle.id}-phrase`;
115
+ return (_jsxs("div", { "data-slot": "confirm-phrase", ...rest, mix: mergeMix([vstack({ gap: 1.5, align: "stretch" })], mix), children: [_jsx(Label, { htmlFor: id, children: children }), _jsx(ConfirmPhrase, { id: id, value: value, name: name })] }));
116
+ };
117
+ };
118
+ /**
119
+ * The end-aligned row holding Cancel, then the confirming control.
120
+ *
121
+ * @param handle Runtime handle carrying the host `<div>`'s props.
122
+ * @returns The render function producing the row.
123
+ */
124
+ Confirm.Footer = function ConfirmFooter(handle) {
125
+ return () => _jsx(AlertDialog.Footer, { ...handle.props });
126
+ };
127
+ /**
128
+ * Backs out without confirming, closing the panel. It takes focus when the panel opens, so
129
+ * Enter on a destructive prompt starts on the safe choice.
130
+ *
131
+ * @param handle Runtime handle carrying the button's props.
132
+ * @returns The render function producing the control.
133
+ */
134
+ Confirm.Cancel = function ConfirmCancel(handle) {
135
+ return () => {
136
+ let context = handle.context.get(Confirm);
137
+ return (_jsx(AlertDialog.Cancel, { commandfor: context?.id ?? "", autofocus: true, ...handle.props }));
138
+ };
139
+ };
140
+ /**
141
+ * The confirming control in the root's colour: inside a {@link Confirm.Form} it submits the
142
+ * form, otherwise it closes the panel for the page to react to.
143
+ *
144
+ * @param handle Runtime handle carrying the button's props.
145
+ * @returns The render function producing the control.
146
+ */
147
+ Confirm.Action = function ConfirmAction(handle) {
148
+ return () => {
149
+ let context = handle.context.get(Confirm);
150
+ let form = handle.context.get(Confirm.Form);
151
+ return (_jsx(AlertDialog.Action, { "data-confirm-action": "", type: form ? "submit" : undefined, commandfor: form ? undefined : context?.id, color: context?.color ?? DEFAULT_COLOR, ...handle.props }));
152
+ };
153
+ };
73
154
  /**
74
155
  * Turns a phrase into a `pattern` that matches only that phrase.
75
156
  *
@@ -80,16 +161,16 @@ function escapePattern(value) {
80
161
  return value.replace(PATTERN_SYNTAX, "\\$&");
81
162
  }
82
163
  /**
83
- * Client island: the field a type-to-confirm prompt holds. It disables the dialog's
164
+ * Client island: the input a type-to-confirm prompt holds. It disables the dialog's
84
165
  * confirming control until the typed text matches and clears itself when the dialog
85
166
  * closes, so every opening starts locked; without script, `pattern` blocks the submit.
86
167
  *
87
168
  * @example
88
- * <ConfirmPhrase id="delete-team-phrase" value="acme" label='Type "acme" to confirm' />
169
+ * <ConfirmPhrase id="delete-team-phrase" value="acme" />
89
170
  */
90
171
  export const ConfirmPhrase = clientEntry("@sdxc/ui/confirm#ConfirmPhrase", function ConfirmPhrase(handle) {
91
172
  return () => {
92
- let { id, label, name, value } = handle.props;
93
- return (_jsxs("div", { "data-slot": "confirm-phrase", mix: [vstack({ gap: 1.5, align: "stretch" })], children: [_jsx(Label, { htmlFor: id, children: label }), _jsx(Input, { id: id, name: name, required: true, autofocus: true, autocomplete: "off", spellcheck: false, pattern: escapePattern(value), mix: [confirmPhrase(value)] })] }));
173
+ let { id, name, value } = handle.props;
174
+ return (_jsx(Input, { id: id, name: name, required: true, autofocus: true, autocomplete: "off", spellcheck: false, pattern: escapePattern(value), mix: [confirmPhrase(value)] }));
94
175
  };
95
176
  });