@senvenli/react 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (636) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +32 -2
  3. package/dist/action/button-group.d.ts +26 -0
  4. package/dist/action/button-group.js +12 -0
  5. package/dist/action/button-group.js.map +1 -0
  6. package/dist/action/button.d.ts +42 -0
  7. package/dist/action/button.js +58 -0
  8. package/dist/action/button.js.map +1 -0
  9. package/dist/action/close-button.d.ts +12 -0
  10. package/dist/action/close-button.js +13 -0
  11. package/dist/action/close-button.js.map +1 -0
  12. package/dist/action/copy-button.d.ts +21 -0
  13. package/dist/action/copy-button.js +38 -0
  14. package/dist/action/copy-button.js.map +1 -0
  15. package/dist/action/fab.d.ts +29 -0
  16. package/dist/action/fab.js +57 -0
  17. package/dist/action/fab.js.map +1 -0
  18. package/dist/action/files.d.ts +70 -0
  19. package/dist/action/files.js +156 -0
  20. package/dist/action/files.js.map +1 -0
  21. package/dist/action/index.d.ts +23 -0
  22. package/dist/action/index.js +16 -0
  23. package/dist/action/index.js.map +1 -0
  24. package/dist/action/language-names.d.ts +19 -0
  25. package/dist/action/language-names.js +79 -0
  26. package/dist/action/language-names.js.map +1 -0
  27. package/dist/action/language-switcher.d.ts +57 -0
  28. package/dist/action/language-switcher.js +53 -0
  29. package/dist/action/language-switcher.js.map +1 -0
  30. package/dist/action/link-button.d.ts +57 -0
  31. package/dist/action/link-button.js +48 -0
  32. package/dist/action/link-button.js.map +1 -0
  33. package/dist/action/link.d.ts +24 -0
  34. package/dist/action/link.js +18 -0
  35. package/dist/action/link.js.map +1 -0
  36. package/dist/action/pressable.d.ts +40 -0
  37. package/dist/action/pressable.js +65 -0
  38. package/dist/action/pressable.js.map +1 -0
  39. package/dist/action/styles.d.ts +60 -0
  40. package/dist/action/styles.js +109 -0
  41. package/dist/action/styles.js.map +1 -0
  42. package/dist/action/theme-script.d.ts +12 -0
  43. package/dist/action/theme-script.js +23 -0
  44. package/dist/action/theme-script.js.map +1 -0
  45. package/dist/action/theme-switcher.d.ts +43 -0
  46. package/dist/action/theme-switcher.js +260 -0
  47. package/dist/action/theme-switcher.js.map +1 -0
  48. package/dist/action/theme-toggle.d.ts +43 -0
  49. package/dist/action/theme-toggle.js +259 -0
  50. package/dist/action/theme-toggle.js.map +1 -0
  51. package/dist/action/toggle.d.ts +44 -0
  52. package/dist/action/toggle.js +28 -0
  53. package/dist/action/toggle.js.map +1 -0
  54. package/dist/action/touch-target.d.ts +9 -0
  55. package/dist/action/touch-target.js +14 -0
  56. package/dist/action/touch-target.js.map +1 -0
  57. package/dist/charts/axis-width.d.ts +186 -0
  58. package/dist/charts/axis-width.js +1262 -0
  59. package/dist/charts/axis-width.js.map +1 -0
  60. package/dist/charts/bar-public.d.ts +16 -0
  61. package/dist/charts/bar-public.js +16 -0
  62. package/dist/charts/bar-public.js.map +1 -0
  63. package/dist/charts/chart-parts.d.ts +136 -0
  64. package/dist/charts/chart-parts.js +160 -0
  65. package/dist/charts/chart-parts.js.map +1 -0
  66. package/dist/charts/core-charts.d.ts +157 -0
  67. package/dist/charts/core-charts.js +505 -0
  68. package/dist/charts/core-charts.js.map +1 -0
  69. package/dist/charts/index.d.ts +12 -0
  70. package/dist/charts/index.js +8 -0
  71. package/dist/charts/index.js.map +1 -0
  72. package/dist/charts/list-charts.d.ts +124 -0
  73. package/dist/charts/list-charts.js +308 -0
  74. package/dist/charts/list-charts.js.map +1 -0
  75. package/dist/charts/more-charts.d.ts +138 -0
  76. package/dist/charts/more-charts.js +284 -0
  77. package/dist/charts/more-charts.js.map +1 -0
  78. package/dist/charts/report-charts.d.ts +138 -0
  79. package/dist/charts/report-charts.js +370 -0
  80. package/dist/charts/report-charts.js.map +1 -0
  81. package/dist/charts/value-tick.d.ts +178 -0
  82. package/dist/charts/value-tick.js +240 -0
  83. package/dist/charts/value-tick.js.map +1 -0
  84. package/dist/collection/data-table-url-hook.d.ts +34 -0
  85. package/dist/collection/data-table-url-hook.js +70 -0
  86. package/dist/collection/data-table-url-hook.js.map +1 -0
  87. package/dist/collection/data-table-url.d.ts +30 -0
  88. package/dist/collection/data-table-url.js +48 -0
  89. package/dist/collection/data-table-url.js.map +1 -0
  90. package/dist/collection/data-table.d.ts +112 -0
  91. package/dist/collection/data-table.js +188 -0
  92. package/dist/collection/data-table.js.map +1 -0
  93. package/dist/collection/grid-list-public.d.ts +18 -0
  94. package/dist/collection/grid-list-public.js +19 -0
  95. package/dist/collection/grid-list-public.js.map +1 -0
  96. package/dist/collection/grid-list.d.ts +73 -0
  97. package/dist/collection/grid-list.js +46 -0
  98. package/dist/collection/grid-list.js.map +1 -0
  99. package/dist/collection/index.d.ts +14 -0
  100. package/dist/collection/index.js +8 -0
  101. package/dist/collection/index.js.map +1 -0
  102. package/dist/collection/list.d.ts +61 -0
  103. package/dist/collection/list.js +38 -0
  104. package/dist/collection/list.js.map +1 -0
  105. package/dist/collection/selection-checkbox.d.ts +5 -0
  106. package/dist/collection/selection-checkbox.js +13 -0
  107. package/dist/collection/selection-checkbox.js.map +1 -0
  108. package/dist/collection/table.d.ts +91 -0
  109. package/dist/collection/table.js +183 -0
  110. package/dist/collection/table.js.map +1 -0
  111. package/dist/collection/tree.d.ts +31 -0
  112. package/dist/collection/tree.js +22 -0
  113. package/dist/collection/tree.js.map +1 -0
  114. package/dist/color/color.d.ts +87 -0
  115. package/dist/color/color.js +200 -0
  116. package/dist/color/color.js.map +1 -0
  117. package/dist/color/contrast.d.ts +34 -0
  118. package/dist/color/contrast.js +44 -0
  119. package/dist/color/contrast.js.map +1 -0
  120. package/dist/color/index.d.ts +4 -0
  121. package/dist/color/index.js +5 -0
  122. package/dist/color/index.js.map +1 -0
  123. package/dist/date/calendar.d.ts +71 -0
  124. package/dist/date/calendar.js +291 -0
  125. package/dist/date/calendar.js.map +1 -0
  126. package/dist/date/fields.d.ts +174 -0
  127. package/dist/date/fields.js +250 -0
  128. package/dist/date/fields.js.map +1 -0
  129. package/dist/date/index.d.ts +7 -0
  130. package/dist/date/index.js +6 -0
  131. package/dist/date/index.js.map +1 -0
  132. package/dist/date/month-grid.d.ts +31 -0
  133. package/dist/date/month-grid.js +115 -0
  134. package/dist/date/month-grid.js.map +1 -0
  135. package/dist/date/pickers.d.ts +118 -0
  136. package/dist/date/pickers.js +176 -0
  137. package/dist/date/pickers.js.map +1 -0
  138. package/dist/date/public.d.ts +25 -0
  139. package/dist/date/public.js +24 -0
  140. package/dist/date/public.js.map +1 -0
  141. package/dist/date/segments.d.ts +153 -0
  142. package/dist/date/segments.js +433 -0
  143. package/dist/date/segments.js.map +1 -0
  144. package/dist/defaults.d.ts +74 -0
  145. package/dist/defaults.js +100 -0
  146. package/dist/defaults.js.map +1 -0
  147. package/dist/density.d.ts +2 -0
  148. package/dist/density.js +2 -0
  149. package/dist/density.js.map +1 -0
  150. package/dist/display/avatar.d.ts +29 -0
  151. package/dist/display/avatar.js +71 -0
  152. package/dist/display/avatar.js.map +1 -0
  153. package/dist/display/badge.d.ts +65 -0
  154. package/dist/display/badge.js +99 -0
  155. package/dist/display/badge.js.map +1 -0
  156. package/dist/display/card.d.ts +72 -0
  157. package/dist/display/card.js +91 -0
  158. package/dist/display/card.js.map +1 -0
  159. package/dist/display/carousel.d.ts +47 -0
  160. package/dist/display/carousel.js +214 -0
  161. package/dist/display/carousel.js.map +1 -0
  162. package/dist/display/description-list.d.ts +25 -0
  163. package/dist/display/description-list.js +36 -0
  164. package/dist/display/description-list.js.map +1 -0
  165. package/dist/display/icon-aliases.d.ts +1 -0
  166. package/dist/display/icon-aliases.js +259 -0
  167. package/dist/display/icon-aliases.js.map +1 -0
  168. package/dist/display/icon-names.d.ts +4 -0
  169. package/dist/display/icon-names.js +2 -0
  170. package/dist/display/icon-names.js.map +1 -0
  171. package/dist/display/icon.d.ts +51 -0
  172. package/dist/display/icon.js +96 -0
  173. package/dist/display/icon.js.map +1 -0
  174. package/dist/display/image-crop.d.ts +106 -0
  175. package/dist/display/image-crop.js +117 -0
  176. package/dist/display/image-crop.js.map +1 -0
  177. package/dist/display/image-cropper.d.ts +68 -0
  178. package/dist/display/image-cropper.js +284 -0
  179. package/dist/display/image-cropper.js.map +1 -0
  180. package/dist/display/image-viewer.d.ts +54 -0
  181. package/dist/display/image-viewer.js +84 -0
  182. package/dist/display/image-viewer.js.map +1 -0
  183. package/dist/display/image.d.ts +26 -0
  184. package/dist/display/image.js +17 -0
  185. package/dist/display/image.js.map +1 -0
  186. package/dist/display/index.d.ts +29 -0
  187. package/dist/display/index.js +16 -0
  188. package/dist/display/index.js.map +1 -0
  189. package/dist/display/iso-chip.d.ts +19 -0
  190. package/dist/display/iso-chip.js +21 -0
  191. package/dist/display/iso-chip.js.map +1 -0
  192. package/dist/display/kbd.d.ts +11 -0
  193. package/dist/display/kbd.js +33 -0
  194. package/dist/display/kbd.js.map +1 -0
  195. package/dist/display/lozenge.d.ts +30 -0
  196. package/dist/display/lozenge.js +55 -0
  197. package/dist/display/lozenge.js.map +1 -0
  198. package/dist/display/scroll-area.d.ts +29 -0
  199. package/dist/display/scroll-area.js +95 -0
  200. package/dist/display/scroll-area.js.map +1 -0
  201. package/dist/display/separator.d.ts +13 -0
  202. package/dist/display/separator.js +24 -0
  203. package/dist/display/separator.js.map +1 -0
  204. package/dist/display/stat.d.ts +35 -0
  205. package/dist/display/stat.js +41 -0
  206. package/dist/display/stat.js.map +1 -0
  207. package/dist/display/timeline.d.ts +44 -0
  208. package/dist/display/timeline.js +111 -0
  209. package/dist/display/timeline.js.map +1 -0
  210. package/dist/display/typography.d.ts +37 -0
  211. package/dist/display/typography.js +53 -0
  212. package/dist/display/typography.js.map +1 -0
  213. package/dist/display/visually-hidden.d.ts +14 -0
  214. package/dist/display/visually-hidden.js +10 -0
  215. package/dist/display/visually-hidden.js.map +1 -0
  216. package/dist/feedback/banner.d.ts +46 -0
  217. package/dist/feedback/banner.js +157 -0
  218. package/dist/feedback/banner.js.map +1 -0
  219. package/dist/feedback/cooldown.d.ts +17 -0
  220. package/dist/feedback/cooldown.js +59 -0
  221. package/dist/feedback/cooldown.js.map +1 -0
  222. package/dist/feedback/empty-state.d.ts +35 -0
  223. package/dist/feedback/empty-state.js +39 -0
  224. package/dist/feedback/empty-state.js.map +1 -0
  225. package/dist/feedback/index.d.ts +12 -0
  226. package/dist/feedback/index.js +11 -0
  227. package/dist/feedback/index.js.map +1 -0
  228. package/dist/feedback/meter.d.ts +33 -0
  229. package/dist/feedback/meter.js +42 -0
  230. package/dist/feedback/meter.js.map +1 -0
  231. package/dist/feedback/motion.d.ts +9 -0
  232. package/dist/feedback/motion.js +57 -0
  233. package/dist/feedback/motion.js.map +1 -0
  234. package/dist/feedback/progress.d.ts +39 -0
  235. package/dist/feedback/progress.js +68 -0
  236. package/dist/feedback/progress.js.map +1 -0
  237. package/dist/feedback/skeleton.d.ts +48 -0
  238. package/dist/feedback/skeleton.js +61 -0
  239. package/dist/feedback/skeleton.js.map +1 -0
  240. package/dist/feedback/spinner.d.ts +19 -0
  241. package/dist/feedback/spinner.js +29 -0
  242. package/dist/feedback/spinner.js.map +1 -0
  243. package/dist/feedback/status-dot.d.ts +23 -0
  244. package/dist/feedback/status-dot.js +37 -0
  245. package/dist/feedback/status-dot.js.map +1 -0
  246. package/dist/form/countries.d.ts +34 -0
  247. package/dist/form/countries.js +273 -0
  248. package/dist/form/countries.js.map +1 -0
  249. package/dist/form/data-attributes.d.ts +11 -0
  250. package/dist/form/data-attributes.js +22 -0
  251. package/dist/form/data-attributes.js.map +1 -0
  252. package/dist/form/field-parts.d.ts +113 -0
  253. package/dist/form/field-parts.js +178 -0
  254. package/dist/form/field-parts.js.map +1 -0
  255. package/dist/form/field.d.ts +36 -0
  256. package/dist/form/field.js +65 -0
  257. package/dist/form/field.js.map +1 -0
  258. package/dist/form/files.d.ts +70 -0
  259. package/dist/form/files.js +156 -0
  260. package/dist/form/files.js.map +1 -0
  261. package/dist/form/form.d.ts +40 -0
  262. package/dist/form/form.js +74 -0
  263. package/dist/form/form.js.map +1 -0
  264. package/dist/form/image-crop.d.ts +106 -0
  265. package/dist/form/image-crop.js +117 -0
  266. package/dist/form/image-crop.js.map +1 -0
  267. package/dist/form/image-cropper.d.ts +68 -0
  268. package/dist/form/image-cropper.js +284 -0
  269. package/dist/form/image-cropper.js.map +1 -0
  270. package/dist/form/index.d.ts +24 -0
  271. package/dist/form/index.js +15 -0
  272. package/dist/form/index.js.map +1 -0
  273. package/dist/form/input-group.d.ts +63 -0
  274. package/dist/form/input-group.js +63 -0
  275. package/dist/form/input-group.js.map +1 -0
  276. package/dist/form/input-otp.d.ts +35 -0
  277. package/dist/form/input-otp.js +83 -0
  278. package/dist/form/input-otp.js.map +1 -0
  279. package/dist/form/input.d.ts +36 -0
  280. package/dist/form/input.js +41 -0
  281. package/dist/form/input.js.map +1 -0
  282. package/dist/form/number-field.d.ts +84 -0
  283. package/dist/form/number-field.js +81 -0
  284. package/dist/form/number-field.js.map +1 -0
  285. package/dist/form/otp-field.d.ts +37 -0
  286. package/dist/form/otp-field.js +116 -0
  287. package/dist/form/otp-field.js.map +1 -0
  288. package/dist/form/password-field.d.ts +61 -0
  289. package/dist/form/password-field.js +61 -0
  290. package/dist/form/password-field.js.map +1 -0
  291. package/dist/form/phone-field.d.ts +104 -0
  292. package/dist/form/phone-field.js +275 -0
  293. package/dist/form/phone-field.js.map +1 -0
  294. package/dist/form/phone-paste.d.ts +24 -0
  295. package/dist/form/phone-paste.js +40 -0
  296. package/dist/form/phone-paste.js.map +1 -0
  297. package/dist/form/phone.d.ts +159 -0
  298. package/dist/form/phone.js +309 -0
  299. package/dist/form/phone.js.map +1 -0
  300. package/dist/form/search-field.d.ts +29 -0
  301. package/dist/form/search-field.js +23 -0
  302. package/dist/form/search-field.js.map +1 -0
  303. package/dist/form/styles.d.ts +31 -0
  304. package/dist/form/styles.js +43 -0
  305. package/dist/form/styles.js.map +1 -0
  306. package/dist/form/text-area.d.ts +70 -0
  307. package/dist/form/text-area.js +93 -0
  308. package/dist/form/text-area.js.map +1 -0
  309. package/dist/form/text-field.d.ts +131 -0
  310. package/dist/form/text-field.js +59 -0
  311. package/dist/form/text-field.js.map +1 -0
  312. package/dist/form/validation.d.ts +145 -0
  313. package/dist/form/validation.js +136 -0
  314. package/dist/form/validation.js.map +1 -0
  315. package/dist/i18n.d.ts +438 -0
  316. package/dist/i18n.js +948 -0
  317. package/dist/i18n.js.map +1 -0
  318. package/dist/index.d.ts +9 -0
  319. package/dist/index.js +7 -0
  320. package/dist/index.js.map +1 -0
  321. package/dist/intl-locale.d.ts +30 -0
  322. package/dist/intl-locale.js +83 -0
  323. package/dist/intl-locale.js.map +1 -0
  324. package/dist/layers.d.ts +32 -0
  325. package/dist/layers.js +33 -0
  326. package/dist/layers.js.map +1 -0
  327. package/dist/layout/auth-form-layout.d.ts +71 -0
  328. package/dist/layout/auth-form-layout.js +61 -0
  329. package/dist/layout/auth-form-layout.js.map +1 -0
  330. package/dist/layout/auth-layout.d.ts +59 -0
  331. package/dist/layout/auth-layout.js +26 -0
  332. package/dist/layout/auth-layout.js.map +1 -0
  333. package/dist/layout/box.d.ts +26 -0
  334. package/dist/layout/box.js +16 -0
  335. package/dist/layout/box.js.map +1 -0
  336. package/dist/layout/grid.d.ts +27 -0
  337. package/dist/layout/grid.js +26 -0
  338. package/dist/layout/grid.js.map +1 -0
  339. package/dist/layout/index.d.ts +16 -0
  340. package/dist/layout/index.js +12 -0
  341. package/dist/layout/index.js.map +1 -0
  342. package/dist/layout/pressable.d.ts +40 -0
  343. package/dist/layout/pressable.js +65 -0
  344. package/dist/layout/pressable.js.map +1 -0
  345. package/dist/layout/reset-sent-card.d.ts +39 -0
  346. package/dist/layout/reset-sent-card.js +22 -0
  347. package/dist/layout/reset-sent-card.js.map +1 -0
  348. package/dist/layout/scroll-area.d.ts +29 -0
  349. package/dist/layout/scroll-area.js +95 -0
  350. package/dist/layout/scroll-area.js.map +1 -0
  351. package/dist/layout/section.d.ts +41 -0
  352. package/dist/layout/section.js +22 -0
  353. package/dist/layout/section.js.map +1 -0
  354. package/dist/layout/split.d.ts +50 -0
  355. package/dist/layout/split.js +35 -0
  356. package/dist/layout/split.js.map +1 -0
  357. package/dist/layout/stack.d.ts +44 -0
  358. package/dist/layout/stack.js +36 -0
  359. package/dist/layout/stack.js.map +1 -0
  360. package/dist/layout/tokens.d.ts +33 -0
  361. package/dist/layout/tokens.js +85 -0
  362. package/dist/layout/tokens.js.map +1 -0
  363. package/dist/layout/toolbar.d.ts +37 -0
  364. package/dist/layout/toolbar.js +334 -0
  365. package/dist/layout/toolbar.js.map +1 -0
  366. package/dist/navigate-context.d.ts +12 -0
  367. package/dist/navigate-context.js +13 -0
  368. package/dist/navigate-context.js.map +1 -0
  369. package/dist/navigation/accordion.d.ts +40 -0
  370. package/dist/navigation/accordion.js +33 -0
  371. package/dist/navigation/accordion.js.map +1 -0
  372. package/dist/navigation/bottom-nav.d.ts +29 -0
  373. package/dist/navigation/bottom-nav.js +48 -0
  374. package/dist/navigation/bottom-nav.js.map +1 -0
  375. package/dist/navigation/brand-link-context.d.ts +8 -0
  376. package/dist/navigation/brand-link-context.js +9 -0
  377. package/dist/navigation/brand-link-context.js.map +1 -0
  378. package/dist/navigation/breadcrumbs.d.ts +36 -0
  379. package/dist/navigation/breadcrumbs.js +51 -0
  380. package/dist/navigation/breadcrumbs.js.map +1 -0
  381. package/dist/navigation/dock.d.ts +27 -0
  382. package/dist/navigation/dock.js +47 -0
  383. package/dist/navigation/dock.js.map +1 -0
  384. package/dist/navigation/footer.d.ts +43 -0
  385. package/dist/navigation/footer.js +43 -0
  386. package/dist/navigation/footer.js.map +1 -0
  387. package/dist/navigation/index.d.ts +22 -0
  388. package/dist/navigation/index.js +17 -0
  389. package/dist/navigation/index.js.map +1 -0
  390. package/dist/navigation/language-names.d.ts +19 -0
  391. package/dist/navigation/language-names.js +79 -0
  392. package/dist/navigation/language-names.js.map +1 -0
  393. package/dist/navigation/language-switcher.d.ts +55 -0
  394. package/dist/navigation/language-switcher.js +53 -0
  395. package/dist/navigation/language-switcher.js.map +1 -0
  396. package/dist/navigation/nav-panel.d.ts +18 -0
  397. package/dist/navigation/nav-panel.js +51 -0
  398. package/dist/navigation/nav-panel.js.map +1 -0
  399. package/dist/navigation/navbar.d.ts +73 -0
  400. package/dist/navigation/navbar.js +64 -0
  401. package/dist/navigation/navbar.js.map +1 -0
  402. package/dist/navigation/page-header.d.ts +37 -0
  403. package/dist/navigation/page-header.js +50 -0
  404. package/dist/navigation/page-header.js.map +1 -0
  405. package/dist/navigation/pagination.d.ts +25 -0
  406. package/dist/navigation/pagination.js +51 -0
  407. package/dist/navigation/pagination.js.map +1 -0
  408. package/dist/navigation/panel-header.d.ts +37 -0
  409. package/dist/navigation/panel-header.js +50 -0
  410. package/dist/navigation/panel-header.js.map +1 -0
  411. package/dist/navigation/sidebar-script.d.ts +12 -0
  412. package/dist/navigation/sidebar-script.js +20 -0
  413. package/dist/navigation/sidebar-script.js.map +1 -0
  414. package/dist/navigation/sidebar.d.ts +149 -0
  415. package/dist/navigation/sidebar.js +332 -0
  416. package/dist/navigation/sidebar.js.map +1 -0
  417. package/dist/navigation/skip-link.d.ts +12 -0
  418. package/dist/navigation/skip-link.js +30 -0
  419. package/dist/navigation/skip-link.js.map +1 -0
  420. package/dist/navigation/stepper.d.ts +50 -0
  421. package/dist/navigation/stepper.js +96 -0
  422. package/dist/navigation/stepper.js.map +1 -0
  423. package/dist/navigation/tabs.d.ts +84 -0
  424. package/dist/navigation/tabs.js +118 -0
  425. package/dist/navigation/tabs.js.map +1 -0
  426. package/dist/navigation/toolbar.d.ts +37 -0
  427. package/dist/navigation/toolbar.js +334 -0
  428. package/dist/navigation/toolbar.js.map +1 -0
  429. package/dist/overlay/alert-dialog.d.ts +63 -0
  430. package/dist/overlay/alert-dialog.js +76 -0
  431. package/dist/overlay/alert-dialog.js.map +1 -0
  432. package/dist/overlay/command-palette.d.ts +53 -0
  433. package/dist/overlay/command-palette.js +130 -0
  434. package/dist/overlay/command-palette.js.map +1 -0
  435. package/dist/overlay/command.d.ts +53 -0
  436. package/dist/overlay/command.js +129 -0
  437. package/dist/overlay/command.js.map +1 -0
  438. package/dist/overlay/context-menu.d.ts +29 -0
  439. package/dist/overlay/context-menu.js +58 -0
  440. package/dist/overlay/context-menu.js.map +1 -0
  441. package/dist/overlay/dialog.d.ts +162 -0
  442. package/dist/overlay/dialog.js +174 -0
  443. package/dist/overlay/dialog.js.map +1 -0
  444. package/dist/overlay/drawer.d.ts +41 -0
  445. package/dist/overlay/drawer.js +114 -0
  446. package/dist/overlay/drawer.js.map +1 -0
  447. package/dist/overlay/floating.d.ts +142 -0
  448. package/dist/overlay/floating.js +226 -0
  449. package/dist/overlay/floating.js.map +1 -0
  450. package/dist/overlay/hover-card.d.ts +19 -0
  451. package/dist/overlay/hover-card.js +31 -0
  452. package/dist/overlay/hover-card.js.map +1 -0
  453. package/dist/overlay/index.d.ts +18 -0
  454. package/dist/overlay/index.js +12 -0
  455. package/dist/overlay/index.js.map +1 -0
  456. package/dist/overlay/overlay-base.d.ts +105 -0
  457. package/dist/overlay/overlay-base.js +250 -0
  458. package/dist/overlay/overlay-base.js.map +1 -0
  459. package/dist/overlay/overlay.d.ts +299 -0
  460. package/dist/overlay/overlay.js +558 -0
  461. package/dist/overlay/overlay.js.map +1 -0
  462. package/dist/overlay/toast.d.ts +58 -0
  463. package/dist/overlay/toast.js +145 -0
  464. package/dist/overlay/toast.js.map +1 -0
  465. package/dist/provider.d.ts +26 -0
  466. package/dist/provider.js +30 -0
  467. package/dist/provider.js.map +1 -0
  468. package/dist/selection/autocomplete.d.ts +54 -0
  469. package/dist/selection/autocomplete.js +122 -0
  470. package/dist/selection/autocomplete.js.map +1 -0
  471. package/dist/selection/checkbox.d.ts +56 -0
  472. package/dist/selection/checkbox.js +49 -0
  473. package/dist/selection/checkbox.js.map +1 -0
  474. package/dist/selection/choice-size.d.ts +26 -0
  475. package/dist/selection/choice-size.js +50 -0
  476. package/dist/selection/choice-size.js.map +1 -0
  477. package/dist/selection/choice-text.d.ts +21 -0
  478. package/dist/selection/choice-text.js +33 -0
  479. package/dist/selection/choice-text.js.map +1 -0
  480. package/dist/selection/combobox.d.ts +173 -0
  481. package/dist/selection/combobox.js +410 -0
  482. package/dist/selection/combobox.js.map +1 -0
  483. package/dist/selection/index.d.ts +20 -0
  484. package/dist/selection/index.js +13 -0
  485. package/dist/selection/index.js.map +1 -0
  486. package/dist/selection/list-box.d.ts +30 -0
  487. package/dist/selection/list-box.js +16 -0
  488. package/dist/selection/list-box.js.map +1 -0
  489. package/dist/selection/listbox.d.ts +44 -0
  490. package/dist/selection/listbox.js +49 -0
  491. package/dist/selection/listbox.js.map +1 -0
  492. package/dist/selection/match.d.ts +20 -0
  493. package/dist/selection/match.js +57 -0
  494. package/dist/selection/match.js.map +1 -0
  495. package/dist/selection/multi-select.d.ts +72 -0
  496. package/dist/selection/multi-select.js +138 -0
  497. package/dist/selection/multi-select.js.map +1 -0
  498. package/dist/selection/radio-card.d.ts +31 -0
  499. package/dist/selection/radio-card.js +29 -0
  500. package/dist/selection/radio-card.js.map +1 -0
  501. package/dist/selection/radio.d.ts +72 -0
  502. package/dist/selection/radio.js +64 -0
  503. package/dist/selection/radio.js.map +1 -0
  504. package/dist/selection/select-public.d.ts +19 -0
  505. package/dist/selection/select-public.js +24 -0
  506. package/dist/selection/select-public.js.map +1 -0
  507. package/dist/selection/select.d.ts +72 -0
  508. package/dist/selection/select.js +69 -0
  509. package/dist/selection/select.js.map +1 -0
  510. package/dist/selection/slider.d.ts +16 -0
  511. package/dist/selection/slider.js +44 -0
  512. package/dist/selection/slider.js.map +1 -0
  513. package/dist/selection/styles.d.ts +26 -0
  514. package/dist/selection/styles.js +78 -0
  515. package/dist/selection/styles.js.map +1 -0
  516. package/dist/selection/switch.d.ts +24 -0
  517. package/dist/selection/switch.js +27 -0
  518. package/dist/selection/switch.js.map +1 -0
  519. package/dist/selection/tag-group.d.ts +38 -0
  520. package/dist/selection/tag-group.js +45 -0
  521. package/dist/selection/tag-group.js.map +1 -0
  522. package/dist/tone.d.ts +6 -0
  523. package/dist/tone.js +2 -0
  524. package/dist/tone.js.map +1 -0
  525. package/dist/utils.d.ts +9 -0
  526. package/dist/utils.js +42 -0
  527. package/dist/utils.js.map +1 -0
  528. package/manifest/component.full.schema.json +391 -0
  529. package/manifest/component.schema.json +279 -0
  530. package/manifests/accordion.json +299 -0
  531. package/manifests/alert-dialog.json +261 -0
  532. package/manifests/area-chart.json +338 -0
  533. package/manifests/autocomplete.json +299 -0
  534. package/manifests/avatar.json +253 -0
  535. package/manifests/badge.json +288 -0
  536. package/manifests/banner.json +185 -0
  537. package/manifests/bar-chart.json +454 -0
  538. package/manifests/bar-list.json +262 -0
  539. package/manifests/bottom-nav.json +139 -0
  540. package/manifests/box.json +3450 -0
  541. package/manifests/breadcrumbs.json +199 -0
  542. package/manifests/button-group.json +2294 -0
  543. package/manifests/button.json +1211 -0
  544. package/manifests/calendar-heatmap.json +218 -0
  545. package/manifests/calendar.json +299 -0
  546. package/manifests/card.json +308 -0
  547. package/manifests/carousel.json +263 -0
  548. package/manifests/chart-parts.json +309 -0
  549. package/manifests/checkbox.json +998 -0
  550. package/manifests/close-button.json +1000 -0
  551. package/manifests/color-field.json +276 -0
  552. package/manifests/color-picker.json +161 -0
  553. package/manifests/color-swatch-picker.json +220 -0
  554. package/manifests/color-swatch.json +140 -0
  555. package/manifests/combobox.json +581 -0
  556. package/manifests/command.json +275 -0
  557. package/manifests/composed-chart.json +287 -0
  558. package/manifests/context-menu.json +148 -0
  559. package/manifests/copy-button.json +192 -0
  560. package/manifests/data-table.json +334 -0
  561. package/manifests/date-field.json +302 -0
  562. package/manifests/date-picker.json +472 -0
  563. package/manifests/description-list.json +201 -0
  564. package/manifests/dialog.json +322 -0
  565. package/manifests/donut-chart.json +264 -0
  566. package/manifests/drawer.json +211 -0
  567. package/manifests/empty-state.json +185 -0
  568. package/manifests/fab.json +172 -0
  569. package/manifests/field.json +209 -0
  570. package/manifests/file-upload.json +791 -0
  571. package/manifests/form.json +829 -0
  572. package/manifests/funnel-chart.json +223 -0
  573. package/manifests/gauge-chart.json +252 -0
  574. package/manifests/grid-list.json +335 -0
  575. package/manifests/grid.json +3482 -0
  576. package/manifests/heading.json +183 -0
  577. package/manifests/heatmap.json +265 -0
  578. package/manifests/hover-card.json +172 -0
  579. package/manifests/icon.json +201 -0
  580. package/manifests/image-cropper.json +295 -0
  581. package/manifests/image-viewer.json +198 -0
  582. package/manifests/image.json +193 -0
  583. package/manifests/index.json +2035 -0
  584. package/manifests/input-group.json +3571 -0
  585. package/manifests/input.json +1557 -0
  586. package/manifests/kbd.json +98 -0
  587. package/manifests/language-switcher.json +274 -0
  588. package/manifests/line-chart.json +342 -0
  589. package/manifests/link.json +867 -0
  590. package/manifests/list-box.json +213 -0
  591. package/manifests/menu.json +453 -0
  592. package/manifests/meter.json +145 -0
  593. package/manifests/navbar.json +281 -0
  594. package/manifests/otp-field.json +1029 -0
  595. package/manifests/page-header.json +164 -0
  596. package/manifests/pagination.json +181 -0
  597. package/manifests/popover.json +205 -0
  598. package/manifests/pressable.json +367 -0
  599. package/manifests/progress.json +282 -0
  600. package/manifests/radar-chart.json +229 -0
  601. package/manifests/radial-chart.json +195 -0
  602. package/manifests/radio.json +975 -0
  603. package/manifests/scatter-chart.json +277 -0
  604. package/manifests/scroll-area.json +127 -0
  605. package/manifests/section.json +169 -0
  606. package/manifests/select.json +474 -0
  607. package/manifests/separator.json +119 -0
  608. package/manifests/sidebar.json +584 -0
  609. package/manifests/skeleton.json +235 -0
  610. package/manifests/skip-link.json +89 -0
  611. package/manifests/slider.json +706 -0
  612. package/manifests/sparkline.json +208 -0
  613. package/manifests/spinner.json +105 -0
  614. package/manifests/split.json +6618 -0
  615. package/manifests/stack.json +3541 -0
  616. package/manifests/stat.json +192 -0
  617. package/manifests/stepper.json +279 -0
  618. package/manifests/switch.json +205 -0
  619. package/manifests/table.json +375 -0
  620. package/manifests/tabs.json +438 -0
  621. package/manifests/tag-group.json +264 -0
  622. package/manifests/text-area.json +1136 -0
  623. package/manifests/text.json +244 -0
  624. package/manifests/theme-switcher.json +152 -0
  625. package/manifests/time-field.json +284 -0
  626. package/manifests/timeline.json +196 -0
  627. package/manifests/toast.json +87 -0
  628. package/manifests/toggle-button.json +1489 -0
  629. package/manifests/toolbar.json +145 -0
  630. package/manifests/tooltip.json +181 -0
  631. package/manifests/tracker.json +192 -0
  632. package/manifests/tree.json +245 -0
  633. package/manifests/visually-hidden.json +114 -0
  634. package/package.json +117 -3
  635. package/styles/base.css +56 -0
  636. package/styles/theme.css +154 -0
@@ -0,0 +1,14 @@
1
+ import * as React from "react";
2
+ export type VisuallyHiddenProps = {
3
+ children: React.ReactNode;
4
+ /** `span` (default) inside a line, `div` for a block (a hidden heading that names a region). */
5
+ elementType?: "span" | "div" | "h2" | "h3" | "label";
6
+ /** Shown while it, or something in it, has keyboard focus: a skip link, a hidden "edit" action. */
7
+ isFocusable?: boolean;
8
+ id?: string;
9
+ };
10
+ /**
11
+ * Text that screen readers read but the page does not show: the name of an icon-only control's context, a heading
12
+ * for a region the layout already makes obvious. Never hide something a sighted user needs.
13
+ */
14
+ export declare function VisuallyHidden({ children, elementType: Element, isFocusable, id }: VisuallyHiddenProps): React.JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ /**
4
+ * Text that screen readers read but the page does not show: the name of an icon-only control's context, a heading
5
+ * for a region the layout already makes obvious. Never hide something a sighted user needs.
6
+ */
7
+ export function VisuallyHidden({ children, elementType: Element = "span", isFocusable, id }) {
8
+ return (_jsx(Element, { id: id, "data-slot": "visually-hidden", className: isFocusable ? "sr-only focus-within:not-sr-only focus:not-sr-only" : "sr-only", children: children }));
9
+ }
10
+ //# sourceMappingURL=visually-hidden.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"visually-hidden.js","sourceRoot":"","sources":["../../src/display/visually-hidden.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,GAAG,MAAM,EAAE,WAAW,EAAE,EAAE,EAAuB;IAC9G,OAAO,CACL,KAAC,OAAO,IAAC,EAAE,EAAE,EAAE,eAAY,iBAAiB,EAAC,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,oDAAoD,CAAC,CAAC,CAAC,SAAS,YACnI,QAAQ,GACD,CACX,CAAC;AACJ,CAAC","sourcesContent":["import * as React from \"react\";\n\nexport type VisuallyHiddenProps = {\n children: React.ReactNode;\n /** `span` (default) inside a line, `div` for a block (a hidden heading that names a region). */\n elementType?: \"span\" | \"div\" | \"h2\" | \"h3\" | \"label\";\n /** Shown while it, or something in it, has keyboard focus: a skip link, a hidden \"edit\" action. */\n isFocusable?: boolean;\n id?: string;\n};\n\n/**\n * Text that screen readers read but the page does not show: the name of an icon-only control's context, a heading\n * for a region the layout already makes obvious. Never hide something a sighted user needs.\n */\nexport function VisuallyHidden({ children, elementType: Element = \"span\", isFocusable, id }: VisuallyHiddenProps) {\n return (\n <Element id={id} data-slot=\"visually-hidden\" className={isFocusable ? \"sr-only focus-within:not-sr-only focus:not-sr-only\" : \"sr-only\"}>\n {children}\n </Element>\n );\n}\n"]}
@@ -0,0 +1,46 @@
1
+ import * as React from "react";
2
+ import type { Tone } from "../tone.js";
3
+ import { type IconName } from "../display/icon.js";
4
+ export type BannerTone = Exclude<Tone, "neutral" | "brand">;
5
+ type BannerCommon = {
6
+ tone?: BannerTone;
7
+ /** Why, and what to do. */
8
+ children?: React.ReactNode;
9
+ /** Inline: up to two link actions. Floating: a default (neutral) Button, never the gold primary. */
10
+ actions?: React.ReactNode;
11
+ /** Shows a close button; omit for errors that must be resolved. */
12
+ onDismiss?: () => void;
13
+ /** The close button's name when "Close" alone is too vague ("Close cookie notice"). */
14
+ dismissLabel?: string;
15
+ };
16
+ export type BannerProps = BannerCommon & ({
17
+ placement?: "inline";
18
+ /** What happened, one line. */
19
+ title: React.ReactNode;
20
+ "aria-label"?: never;
21
+ avoid?: never;
22
+ icon?: never;
23
+ } | {
24
+ /**
25
+ * Pinned to the bottom of the viewport until the visitor acts on it (a cookie
26
+ * notice). A named region, not a dialog: focus is never moved or trapped and Esc does nothing.
27
+ */
28
+ placement: "floating";
29
+ /** Names the region ("Cookie notice"). */
30
+ "aria-label": string;
31
+ title?: React.ReactNode;
32
+ /** A sticky bottom bar to sit above: its element (measured from its top edge) or a CSS length with a unit ("72px"). */
33
+ avoid?: React.RefObject<HTMLElement | null> | string;
34
+ /** Replaces the tone icon ("cookie"); `null` shows none (narrow phone layouts). */
35
+ icon?: IconName | null;
36
+ });
37
+ /**
38
+ * A section message: explains a condition that affects the page or section
39
+ * it sits in, and stays until the condition changes or the user dismisses
40
+ * it. The status is said by the icon and the title, never by colour alone.
41
+ * For the result of an action the user just took, use Toast.
42
+ * `placement="floating"` pins one message to the bottom of the viewport (the
43
+ * cookie notice).
44
+ */
45
+ export declare function Banner(props: BannerProps): React.JSX.Element;
46
+ export {};
@@ -0,0 +1,157 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { createPortal } from "react-dom";
5
+ import { cn } from "../utils.js";
6
+ import { CloseButton } from "../action/close-button.js";
7
+ import { IconGlyph } from "../display/icon.js";
8
+ import { FLOATING_BANNER_OFFSET, LAYER } from "../layers.js";
9
+ const TONE = {
10
+ information: { frame: "bg-ds-background-information inset-ring-ds-border-information", icon: "info", iconColor: "information" },
11
+ warning: { frame: "bg-ds-background-warning inset-ring-ds-border-warning", icon: "triangle-alert", iconColor: "warning" },
12
+ danger: { frame: "bg-ds-background-danger inset-ring-ds-border-danger", icon: "circle-x", iconColor: "danger" },
13
+ success: { frame: "bg-ds-background-success inset-ring-ds-border-success", icon: "circle-check", iconColor: "success" },
14
+ };
15
+ /** Room the viewport's layout height gives (without a horizontal scrollbar, unlike innerHeight). */
16
+ const viewportHeight = () => document.documentElement.clientHeight || window.innerHeight;
17
+ /**
18
+ * How far a sticky bottom bar reaches up from the bottom of the viewport, as a CSS length, or
19
+ * undefined when there is no bar (the banner then clears the safe area itself). A ref is re-checked
20
+ * whenever the banner commits, so a bar that mounts later or goes away is followed from the banner's
21
+ * next render.
22
+ */
23
+ function useAvoidOffset(avoid) {
24
+ // null: no bar on the page right now.
25
+ const [measured, setMeasured] = React.useState(null);
26
+ const observed = React.useRef(null);
27
+ const cleanup = React.useRef(undefined);
28
+ // No deps: the ref's node is read after each commit (refs are attached by then) and compared.
29
+ React.useLayoutEffect(() => {
30
+ const element = typeof avoid === "string" ? null : (avoid?.current ?? null);
31
+ if (element === observed.current)
32
+ return;
33
+ cleanup.current?.();
34
+ cleanup.current = undefined;
35
+ observed.current = element;
36
+ if (!element) {
37
+ setMeasured(null);
38
+ return;
39
+ }
40
+ const read = () => {
41
+ const box = element.getBoundingClientRect();
42
+ const height = viewportHeight();
43
+ // Only a bar that is rendered and pinned to the bottom of the viewport counts: one hidden with
44
+ // CSS (display: none, a mobile-only bar on desktop) has no box, and a sticky bar still in the
45
+ // page flow is not at the bottom yet. Either way the banner clears the safe area on its own.
46
+ const pinned = element.getClientRects().length > 0 && box.height > 0 && box.bottom >= height - 1;
47
+ setMeasured(pinned ? Math.max(height - box.top, 0) : null);
48
+ };
49
+ read();
50
+ const observer = typeof ResizeObserver === "undefined" ? undefined : new ResizeObserver(read);
51
+ observer?.observe(element);
52
+ window.addEventListener("resize", read);
53
+ // A position: sticky bar pins (or unpins) while the page scrolls; re-read once per frame.
54
+ let frame = 0;
55
+ const onScroll = () => {
56
+ if (frame)
57
+ return;
58
+ frame = window.requestAnimationFrame(() => {
59
+ frame = 0;
60
+ read();
61
+ });
62
+ };
63
+ window.addEventListener("scroll", onScroll, { passive: true, capture: true });
64
+ cleanup.current = () => {
65
+ observer?.disconnect();
66
+ window.removeEventListener("resize", read);
67
+ window.removeEventListener("scroll", onScroll, { capture: true });
68
+ if (frame)
69
+ window.cancelAnimationFrame(frame);
70
+ };
71
+ });
72
+ React.useEffect(() => () => {
73
+ cleanup.current?.();
74
+ cleanup.current = undefined;
75
+ // Forget the node too, so a remount (StrictMode) observes it again.
76
+ observed.current = null;
77
+ }, []);
78
+ if (typeof avoid === "string")
79
+ return avoid;
80
+ return avoid && measured !== null ? `${measured}px` : undefined;
81
+ }
82
+ /**
83
+ * Every shown floating banner registers how much room it takes; the largest is published, so one
84
+ * banner going away never clears the offset another still needs (the design allows one at a time,
85
+ * but a route change can briefly show two).
86
+ */
87
+ const offsets = new Map();
88
+ function publishOffsets() {
89
+ const root = document.documentElement;
90
+ if (offsets.size === 0)
91
+ root.style.removeProperty(FLOATING_BANNER_OFFSET);
92
+ else
93
+ root.style.setProperty(FLOATING_BANNER_OFFSET, `${Math.max(...offsets.values())}px`);
94
+ }
95
+ function FloatingBanner({ tone = "information", title, children, actions, onDismiss, dismissLabel, "aria-label": ariaLabel, avoid, icon, }) {
96
+ const banner = React.useRef(null);
97
+ const avoidOffset = useAvoidOffset(avoid);
98
+ // Portalled to the end of <body> after mount, so it follows the main content in tab order.
99
+ const [host, setHost] = React.useState(null);
100
+ React.useEffect(() => setHost(document.body), []);
101
+ // While shown, tell bottom-fixed layers (Fab, toasts) how much room it takes, so it never covers them.
102
+ React.useLayoutEffect(() => {
103
+ const element = banner.current;
104
+ if (!element)
105
+ return;
106
+ const key = Symbol("floating-banner");
107
+ const publish = () => {
108
+ offsets.set(key, Math.max(viewportHeight() - element.getBoundingClientRect().top, 0));
109
+ publishOffsets();
110
+ };
111
+ publish();
112
+ const observer = typeof ResizeObserver === "undefined" ? undefined : new ResizeObserver(publish);
113
+ observer?.observe(element);
114
+ window.addEventListener("resize", publish);
115
+ return () => {
116
+ observer?.disconnect();
117
+ window.removeEventListener("resize", publish);
118
+ offsets.delete(key);
119
+ publishOffsets();
120
+ };
121
+ }, [host, avoidOffset]);
122
+ const glyph = icon === null ? undefined : (icon ?? TONE[tone].icon);
123
+ if (!host)
124
+ return null;
125
+ // Above a sticky bar the bar already clears the safe area; on its own the banner does.
126
+ const bottom = avoidOffset
127
+ ? `calc(var(--ds-space-200) + ${avoidOffset})`
128
+ : "calc(var(--ds-space-200) + env(safe-area-inset-bottom, 0px))";
129
+ return createPortal(_jsxs("div", { ref: banner, role: "region", "aria-label": ariaLabel, "data-slot": "banner", "data-placement": "floating", "data-tone": tone,
130
+ // Fixed to the bottom: ds-space-200 above the safe area or the sticky bar it must clear; inset
131
+ // ds-space-150 on phones and ds-space-200 from 480px, or the side safe-area inset when larger; at most 720px wide, centred; under a quarter
132
+ // of a phone's height. Layer: above sticky bars, under the Fab, toasts and overlays (layers.ts).
133
+ style: { bottom }, className: cn(
134
+ // Side insets clear the notch in landscape (edge-to-edge viewports): the larger of the spacing and
135
+ // the physical safe-area inset on each side (physical, like the insets themselves).
136
+ "fixed [left:max(var(--ds-space-150),env(safe-area-inset-left,0px))] [right:max(var(--ds-space-150),env(safe-area-inset-right,0px))] min-[480px]:[left:max(var(--ds-space-200),env(safe-area-inset-left,0px))] min-[480px]:[right:max(var(--ds-space-200),env(safe-area-inset-right,0px))]", "mx-auto grid max-h-[25dvh] max-w-[720px] items-center gap-ds-150 overflow-y-auto", LAYER.floatingBanner, "rounded-ds-large bg-ds-surface-overlay px-ds-200 py-ds-150 text-body text-ds-text shadow-ds-overlay inset-ring-1 inset-ring-ds-border", glyph ? "grid-cols-[auto_1fr] min-[480px]:grid-cols-[auto_1fr_auto]" : "grid-cols-1 min-[480px]:grid-cols-[1fr_auto]"), children: [glyph && _jsx(IconGlyph, { name: glyph, size: "large", color: TONE[tone].iconColor, "data-slot": "banner-icon" }), _jsxs("div", { "data-slot": "banner-body", className: "flex min-w-0 flex-col gap-ds-050", children: [title != null && _jsx("span", { "data-slot": "banner-title", className: "text-body-strong", children: title }), children !== undefined && _jsx("div", { "data-slot": "banner-content", children: children })] }), (actions !== undefined || onDismiss) && (
137
+ // Inline on wide screens; under 480px a row of its own below the text.
138
+ _jsxs("div", { "data-slot": "banner-actions", className: "col-span-full flex items-center justify-end gap-ds-100 min-[480px]:col-span-1", children: [actions, onDismiss && _jsx(CloseButton, { onPress: onDismiss, "aria-label": dismissLabel, "data-slot": "banner-dismiss" })] }))] }), host);
139
+ }
140
+ /**
141
+ * A section message: explains a condition that affects the page or section
142
+ * it sits in, and stays until the condition changes or the user dismisses
143
+ * it. The status is said by the icon and the title, never by colour alone.
144
+ * For the result of an action the user just took, use Toast.
145
+ * `placement="floating"` pins one message to the bottom of the viewport (the
146
+ * cookie notice).
147
+ */
148
+ export function Banner(props) {
149
+ if (props.placement === "floating")
150
+ return _jsx(FloatingBanner, { ...props });
151
+ const { tone = "information", title, children, actions, onDismiss, dismissLabel } = props;
152
+ const look = TONE[tone];
153
+ return (_jsxs("div", {
154
+ // Errors interrupt (alert); everything else waits its turn (status).
155
+ role: tone === "danger" ? "alert" : "status", "data-slot": "banner", "data-tone": tone, className: cn("flex items-start gap-ds-150 rounded-ds-large p-ds-200 text-body text-ds-text inset-ring-1", look.frame), children: [_jsx(IconGlyph, { name: look.icon, size: "large", color: look.iconColor, "data-slot": "banner-icon" }), _jsxs("div", { "data-slot": "banner-body", className: "flex min-w-0 flex-1 flex-col gap-ds-050", children: [_jsx("span", { "data-slot": "banner-title", className: "text-body-strong", children: title }), children !== undefined && _jsx("div", { "data-slot": "banner-content", children: children }), actions !== undefined && (_jsx("div", { "data-slot": "banner-actions", className: "mt-ds-050 flex flex-wrap items-center gap-ds-200", children: actions }))] }), onDismiss && _jsx(CloseButton, { onPress: onDismiss, "aria-label": dismissLabel, "data-slot": "banner-dismiss" })] }));
156
+ }
157
+ //# sourceMappingURL=banner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"banner.js","sourceRoot":"","sources":["../../src/feedback/banner.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;A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C,KAAK,EAAE,IAAI,CAAC,SAAS,eAAY,aAAa,GAAG,EAC1F,4BAAe,aAAa,EAAC,SAAS,EAAC,yCAAyC,aAC9E,4BAAgB,cAAc,EAAC,SAAS,EAAC,kBAAkB,YAAE,KAAK,GAAQ,EACzE,QAAQ,KAAK,SAAS,IAAI,2BAAe,gBAAgB,YAAE,QAAQ,GAAO,EAC1E,OAAO,KAAK,SAAS,IAAI,CACxB,2BAAe,gBAAgB,EAAC,SAAS,EAAC,kDAAkD,YAAE,OAAO,GAAO,CAC7G,IACG,EACL,SAAS,IAAI,KAAC,WAAW,IAAC,OAAO,EAAE,SAAS,gBAAc,YAAY,eAAY,gBAAgB,GAAG,IAClG,CACP,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"../utils\";\nimport type { Tone } from \"../tone\";\nimport { CloseButton } from \"../action/close-button\";\nimport { IconGlyph, type IconName } from \"../display/icon\";\nimport { FLOATING_BANNER_OFFSET, LAYER } from \"../layers\";\n\nexport type BannerTone = Exclude<Tone, \"neutral\" | \"brand\">;\n\nconst TONE: Record<BannerTone, { frame: string; icon: IconName; iconColor: \"information\" | \"success\" | \"warning\" | \"danger\" }> = {\n information: { frame: \"bg-ds-background-information inset-ring-ds-border-information\", icon: \"info\", iconColor: \"information\" },\n warning: { frame: \"bg-ds-background-warning inset-ring-ds-border-warning\", icon: \"triangle-alert\", iconColor: \"warning\" },\n danger: { frame: \"bg-ds-background-danger inset-ring-ds-border-danger\", icon: \"circle-x\", iconColor: \"danger\" },\n success: { frame: \"bg-ds-background-success inset-ring-ds-border-success\", icon: \"circle-check\", iconColor: \"success\" },\n};\n\ntype BannerCommon = {\n tone?: BannerTone;\n /** Why, and what to do. */\n children?: React.ReactNode;\n /** Inline: up to two link actions. Floating: a default (neutral) Button, never the gold primary. */\n actions?: React.ReactNode;\n /** Shows a close button; omit for errors that must be resolved. */\n onDismiss?: () => void;\n /** The close button's name when \"Close\" alone is too vague (\"Close cookie notice\"). */\n dismissLabel?: string;\n};\n\nexport type BannerProps = BannerCommon &\n (\n | {\n placement?: \"inline\";\n /** What happened, one line. */\n title: React.ReactNode;\n \"aria-label\"?: never;\n avoid?: never;\n icon?: never;\n }\n | {\n /**\n * Pinned to the bottom of the viewport until the visitor acts on it (a cookie\n * notice). A named region, not a dialog: focus is never moved or trapped and Esc does nothing.\n */\n placement: \"floating\";\n /** Names the region (\"Cookie notice\"). */\n \"aria-label\": string;\n title?: React.ReactNode;\n /** A sticky bottom bar to sit above: its element (measured from its top edge) or a CSS length with a unit (\"72px\"). */\n avoid?: React.RefObject<HTMLElement | null> | string;\n /** Replaces the tone icon (\"cookie\"); `null` shows none (narrow phone layouts). */\n icon?: IconName | null;\n }\n );\n\n/** Room the viewport's layout height gives (without a horizontal scrollbar, unlike innerHeight). */\nconst viewportHeight = () => document.documentElement.clientHeight || window.innerHeight;\n\n/**\n * How far a sticky bottom bar reaches up from the bottom of the viewport, as a CSS length, or\n * undefined when there is no bar (the banner then clears the safe area itself). A ref is re-checked\n * whenever the banner commits, so a bar that mounts later or goes away is followed from the banner's\n * next render.\n */\nfunction useAvoidOffset(avoid: React.RefObject<HTMLElement | null> | string | undefined) {\n // null: no bar on the page right now.\n const [measured, setMeasured] = React.useState<number | null>(null);\n const observed = React.useRef<HTMLElement | null>(null);\n const cleanup = React.useRef<(() => void) | undefined>(undefined);\n // No deps: the ref's node is read after each commit (refs are attached by then) and compared.\n React.useLayoutEffect(() => {\n const element = typeof avoid === \"string\" ? null : (avoid?.current ?? null);\n if (element === observed.current) return;\n cleanup.current?.();\n cleanup.current = undefined;\n observed.current = element;\n if (!element) {\n setMeasured(null);\n return;\n }\n const read = () => {\n const box = element.getBoundingClientRect();\n const height = viewportHeight();\n // Only a bar that is rendered and pinned to the bottom of the viewport counts: one hidden with\n // CSS (display: none, a mobile-only bar on desktop) has no box, and a sticky bar still in the\n // page flow is not at the bottom yet. Either way the banner clears the safe area on its own.\n const pinned = element.getClientRects().length > 0 && box.height > 0 && box.bottom >= height - 1;\n setMeasured(pinned ? Math.max(height - box.top, 0) : null);\n };\n read();\n const observer = typeof ResizeObserver === \"undefined\" ? undefined : new ResizeObserver(read);\n observer?.observe(element);\n window.addEventListener(\"resize\", read);\n // A position: sticky bar pins (or unpins) while the page scrolls; re-read once per frame.\n let frame = 0;\n const onScroll = () => {\n if (frame) return;\n frame = window.requestAnimationFrame(() => {\n frame = 0;\n read();\n });\n };\n window.addEventListener(\"scroll\", onScroll, { passive: true, capture: true });\n cleanup.current = () => {\n observer?.disconnect();\n window.removeEventListener(\"resize\", read);\n window.removeEventListener(\"scroll\", onScroll, { capture: true });\n if (frame) window.cancelAnimationFrame(frame);\n };\n });\n React.useEffect(\n () => () => {\n cleanup.current?.();\n cleanup.current = undefined;\n // Forget the node too, so a remount (StrictMode) observes it again.\n observed.current = null;\n },\n [],\n );\n if (typeof avoid === \"string\") return avoid;\n return avoid && measured !== null ? `${measured}px` : undefined;\n}\n\n/**\n * Every shown floating banner registers how much room it takes; the largest is published, so one\n * banner going away never clears the offset another still needs (the design allows one at a time,\n * but a route change can briefly show two).\n */\nconst offsets = new Map<symbol, number>();\nfunction publishOffsets() {\n const root = document.documentElement;\n if (offsets.size === 0) root.style.removeProperty(FLOATING_BANNER_OFFSET);\n else root.style.setProperty(FLOATING_BANNER_OFFSET, `${Math.max(...offsets.values())}px`);\n}\n\nfunction FloatingBanner({\n tone = \"information\", title, children, actions, onDismiss, dismissLabel, \"aria-label\": ariaLabel, avoid, icon,\n}: Extract<BannerProps, { placement: \"floating\" }>) {\n const banner = React.useRef<HTMLDivElement>(null);\n const avoidOffset = useAvoidOffset(avoid);\n // Portalled to the end of <body> after mount, so it follows the main content in tab order.\n const [host, setHost] = React.useState<HTMLElement | null>(null);\n React.useEffect(() => setHost(document.body), []);\n\n // While shown, tell bottom-fixed layers (Fab, toasts) how much room it takes, so it never covers them.\n React.useLayoutEffect(() => {\n const element = banner.current;\n if (!element) return;\n const key = Symbol(\"floating-banner\");\n const publish = () => {\n offsets.set(key, Math.max(viewportHeight() - element.getBoundingClientRect().top, 0));\n publishOffsets();\n };\n publish();\n const observer = typeof ResizeObserver === \"undefined\" ? undefined : new ResizeObserver(publish);\n observer?.observe(element);\n window.addEventListener(\"resize\", publish);\n return () => {\n observer?.disconnect();\n window.removeEventListener(\"resize\", publish);\n offsets.delete(key);\n publishOffsets();\n };\n }, [host, avoidOffset]);\n\n const glyph = icon === null ? undefined : (icon ?? TONE[tone].icon);\n if (!host) return null;\n // Above a sticky bar the bar already clears the safe area; on its own the banner does.\n const bottom = avoidOffset\n ? `calc(var(--ds-space-200) + ${avoidOffset})`\n : \"calc(var(--ds-space-200) + env(safe-area-inset-bottom, 0px))\";\n return createPortal(\n <div\n ref={banner}\n role=\"region\"\n aria-label={ariaLabel}\n data-slot=\"banner\"\n data-placement=\"floating\"\n data-tone={tone}\n // Fixed to the bottom: ds-space-200 above the safe area or the sticky bar it must clear; inset\n // ds-space-150 on phones and ds-space-200 from 480px, or the side safe-area inset when larger; at most 720px wide, centred; under a quarter\n // of a phone's height. Layer: above sticky bars, under the Fab, toasts and overlays (layers.ts).\n style={{ bottom }}\n className={cn(\n // Side insets clear the notch in landscape (edge-to-edge viewports): the larger of the spacing and\n // the physical safe-area inset on each side (physical, like the insets themselves).\n \"fixed [left:max(var(--ds-space-150),env(safe-area-inset-left,0px))] [right:max(var(--ds-space-150),env(safe-area-inset-right,0px))] min-[480px]:[left:max(var(--ds-space-200),env(safe-area-inset-left,0px))] min-[480px]:[right:max(var(--ds-space-200),env(safe-area-inset-right,0px))]\",\n \"mx-auto grid max-h-[25dvh] max-w-[720px] items-center gap-ds-150 overflow-y-auto\",\n LAYER.floatingBanner,\n \"rounded-ds-large bg-ds-surface-overlay px-ds-200 py-ds-150 text-body text-ds-text shadow-ds-overlay inset-ring-1 inset-ring-ds-border\",\n glyph ? \"grid-cols-[auto_1fr] min-[480px]:grid-cols-[auto_1fr_auto]\" : \"grid-cols-1 min-[480px]:grid-cols-[1fr_auto]\",\n )}\n >\n {glyph && <IconGlyph name={glyph} size=\"large\" color={TONE[tone].iconColor} data-slot=\"banner-icon\" />}\n <div data-slot=\"banner-body\" className=\"flex min-w-0 flex-col gap-ds-050\">\n {title != null && <span data-slot=\"banner-title\" className=\"text-body-strong\">{title}</span>}\n {children !== undefined && <div data-slot=\"banner-content\">{children}</div>}\n </div>\n {(actions !== undefined || onDismiss) && (\n // Inline on wide screens; under 480px a row of its own below the text.\n <div data-slot=\"banner-actions\" className=\"col-span-full flex items-center justify-end gap-ds-100 min-[480px]:col-span-1\">\n {actions}\n {onDismiss && <CloseButton onPress={onDismiss} aria-label={dismissLabel} data-slot=\"banner-dismiss\" />}\n </div>\n )}\n </div>,\n host,\n );\n}\n\n/**\n * A section message: explains a condition that affects the page or section\n * it sits in, and stays until the condition changes or the user dismisses\n * it. The status is said by the icon and the title, never by colour alone.\n * For the result of an action the user just took, use Toast.\n * `placement=\"floating\"` pins one message to the bottom of the viewport (the\n * cookie notice).\n */\nexport function Banner(props: BannerProps) {\n if (props.placement === \"floating\") return <FloatingBanner {...props} />;\n const { tone = \"information\", title, children, actions, onDismiss, dismissLabel } = props;\n const look = TONE[tone];\n return (\n <div\n // Errors interrupt (alert); everything else waits its turn (status).\n role={tone === \"danger\" ? \"alert\" : \"status\"}\n data-slot=\"banner\"\n data-tone={tone}\n className={cn(\"flex items-start gap-ds-150 rounded-ds-large p-ds-200 text-body text-ds-text inset-ring-1\", look.frame)}\n >\n <IconGlyph name={look.icon} size=\"large\" color={look.iconColor} data-slot=\"banner-icon\" />\n <div data-slot=\"banner-body\" className=\"flex min-w-0 flex-1 flex-col gap-ds-050\">\n <span data-slot=\"banner-title\" className=\"text-body-strong\">{title}</span>\n {children !== undefined && <div data-slot=\"banner-content\">{children}</div>}\n {actions !== undefined && (\n <div data-slot=\"banner-actions\" className=\"mt-ds-050 flex flex-wrap items-center gap-ds-200\">{actions}</div>\n )}\n </div>\n {onDismiss && <CloseButton onPress={onDismiss} aria-label={dismissLabel} data-slot=\"banner-dismiss\" />}\n </div>\n );\n}\n"]}
@@ -0,0 +1,17 @@
1
+ export type CooldownAction = {
2
+ /** Runs the action; the cooldown starts only after it succeeds. */
3
+ run: () => Promise<boolean>;
4
+ /** Seconds left before the action is available again. */
5
+ remaining: number;
6
+ /** True while the action is running. */
7
+ isPending: boolean;
8
+ /** True after the last run failed (cleared by the next run). */
9
+ failed: boolean;
10
+ };
11
+ /**
12
+ * The resend pattern (code again, link again): a rejected or throwing action
13
+ * never starts the wait and never escapes as an unhandled rejection
14
+ *; a successful one starts `seconds` of cooldown. `initial` is
15
+ * the wait already running (a code was just sent); a new value restarts it.
16
+ */
17
+ export declare function useCooldownAction(action: (() => unknown) | undefined, seconds: number, initial?: number): CooldownAction;
@@ -0,0 +1,59 @@
1
+ "use client";
2
+ import * as React from "react";
3
+ /**
4
+ * The resend pattern (code again, link again): a rejected or throwing action
5
+ * never starts the wait and never escapes as an unhandled rejection
6
+ *; a successful one starts `seconds` of cooldown. `initial` is
7
+ * the wait already running (a code was just sent); a new value restarts it.
8
+ */
9
+ export function useCooldownAction(action, seconds, initial = 0) {
10
+ const [remaining, setRemaining] = React.useState(initial);
11
+ const [isPending, setPending] = React.useState(false);
12
+ const [failed, setFailed] = React.useState(false);
13
+ const latest = React.useRef(action);
14
+ latest.current = action;
15
+ const running = React.useRef(false);
16
+ const remainingRef = React.useRef(remaining);
17
+ remainingRef.current = remaining;
18
+ // A new initial wait from the parent (a server "retry after") restarts the wait.
19
+ const firstInitial = React.useRef(true);
20
+ React.useEffect(() => {
21
+ if (firstInitial.current) {
22
+ firstInitial.current = false;
23
+ return;
24
+ }
25
+ setRemaining(initial);
26
+ }, [initial]);
27
+ // One interval for the whole wait, counting down with a functional update: no per-tick rescheduling, so a long jump
28
+ // of the clock (a backgrounded tab, fake timers) still lands on the right second.
29
+ const cooling = remaining > 0;
30
+ React.useEffect(() => {
31
+ if (!cooling)
32
+ return;
33
+ const timer = window.setInterval(() => setRemaining((current) => Math.max(0, current - 1)), 1000);
34
+ return () => window.clearInterval(timer);
35
+ }, [cooling]);
36
+ const run = React.useCallback(async () => {
37
+ // One run at a time, and none while the wait is on.
38
+ if (!latest.current || running.current || remainingRef.current > 0)
39
+ return false;
40
+ running.current = true;
41
+ setPending(true);
42
+ setFailed(false);
43
+ try {
44
+ await latest.current();
45
+ setRemaining(seconds);
46
+ return true;
47
+ }
48
+ catch {
49
+ setFailed(true);
50
+ return false;
51
+ }
52
+ finally {
53
+ running.current = false;
54
+ setPending(false);
55
+ }
56
+ }, [seconds]);
57
+ return { run, remaining, isPending, failed };
58
+ }
59
+ //# sourceMappingURL=cooldown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cooldown.js","sourceRoot":"","sources":["../../src/feedback/cooldown.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAa/B;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAmC,EAAE,OAAe,EAAE,OAAO,GAAG,CAAC;IACjG,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC1D,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACpC,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACpC,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC7C,YAAY,C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ACtB,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,MAAM,CAAC;YACP,SAAS,CAAC,IAAI,CAAC,CAAC;YAChB,OAAO,KAAK,CAAC;QACf,CAAC;gBAAS,CAAC;YACT,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC;YACxB,UAAU,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC;IACH,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;AAC/C,CAAC","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nexport type CooldownAction = {\n /** Runs the action; the cooldown starts only after it succeeds. */\n run: () => Promise<boolean>;\n /** Seconds left before the action is available again. */\n remaining: number;\n /** True while the action is running. */\n isPending: boolean;\n /** True after the last run failed (cleared by the next run). */\n failed: boolean;\n};\n\n/**\n * The resend pattern (code again, link again): a rejected or throwing action\n * never starts the wait and never escapes as an unhandled rejection\n *; a successful one starts `seconds` of cooldown. `initial` is\n * the wait already running (a code was just sent); a new value restarts it.\n */\nexport function useCooldownAction(action: (() => unknown) | undefined, seconds: number, initial = 0): CooldownAction {\n const [remaining, setRemaining] = React.useState(initial);\n const [isPending, setPending] = React.useState(false);\n const [failed, setFailed] = React.useState(false);\n const latest = React.useRef(action);\n latest.current = action;\n const running = React.useRef(false);\n const remainingRef = React.useRef(remaining);\n remainingRef.current = remaining;\n\n // A new initial wait from the parent (a server \"retry after\") restarts the wait.\n const firstInitial = React.useRef(true);\n React.useEffect(() => {\n if (firstInitial.current) {\n firstInitial.current = false;\n return;\n }\n setRemaining(initial);\n }, [initial]);\n\n // One interval for the whole wait, counting down with a functional update: no per-tick rescheduling, so a long jump\n // of the clock (a backgrounded tab, fake timers) still lands on the right second.\n const cooling = remaining > 0;\n React.useEffect(() => {\n if (!cooling) return;\n const timer = window.setInterval(() => setRemaining((current) => Math.max(0, current - 1)), 1000);\n return () => window.clearInterval(timer);\n }, [cooling]);\n\n const run = React.useCallback(async () => {\n // One run at a time, and none while the wait is on.\n if (!latest.current || running.current || remainingRef.current > 0) return false;\n running.current = true;\n setPending(true);\n setFailed(false);\n try {\n await latest.current();\n setRemaining(seconds);\n return true;\n } catch {\n setFailed(true);\n return false;\n } finally {\n running.current = false;\n setPending(false);\n }\n }, [seconds]);\n\n return { run, remaining, isPending, failed };\n}\n"]}
@@ -0,0 +1,35 @@
1
+ import * as React from "react";
2
+ import { type IconName } from "../display/icon.js";
3
+ export type StateSize = "small" | "medium";
4
+ /** 1 where the state is the whole page (a 404, a page-level error); 2–4 inside a page. */
5
+ export type StateHeadingLevel = 1 | 2 | 3 | 4;
6
+ export type EmptyStateProps = {
7
+ /** One Lucide icon; no illustrations. */
8
+ icon: IconName;
9
+ /** First use: what will appear here. No results: repeat the query. Cleared: the calm confirmation. */
10
+ title: React.ReactNode;
11
+ /** Renders the title as a heading where the state is the page's main content; a plain line by default. */
12
+ headingLevel?: StateHeadingLevel;
13
+ /** How the content gets here, or the fix; one or two sentences. Never blame the user. */
14
+ description?: React.ReactNode;
15
+ /** The action that fills the view (`Button variant="primary"`), or "Clear filters" for no results. */
16
+ primaryAction?: React.ReactNode;
17
+ secondaryAction?: React.ReactNode;
18
+ /** `compact` inside tables and cards. */
19
+ size?: StateSize;
20
+ /** `danger` for a load that failed or a page that is not allowed: the icon in the danger tone. */
21
+ tone?: "neutral" | "danger";
22
+ /** Extra lines inside the message, under the description: an error code and when it happened, for support. */
23
+ details?: React.ReactNode;
24
+ /**
25
+ * Announce the message (title, description, details) as an alert; the actions stay outside it. For a state that
26
+ * replaces content the user was waiting for (a failed load); not for a first-use or no-results state.
27
+ */
28
+ announce?: boolean;
29
+ };
30
+ /**
31
+ * Explains why a view has no content, or why it could not be shown, and offers the action that changes that: first
32
+ * use, no results, cleared, or (with `tone="danger"`) a load that failed and its retry. Use it instead of an empty
33
+ * table with only headers.
34
+ */
35
+ export declare function EmptyState({ icon, title, headingLevel, description, primaryAction, secondaryAction, size, tone, details, announce }: EmptyStateProps): React.JSX.Element;
@@ -0,0 +1,39 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { cn } from "../utils.js";
5
+ import { IconGlyph } from "../display/icon.js";
6
+ const FRAME = {
7
+ medium: "gap-ds-150 px-ds-300 py-ds-600",
8
+ small: "gap-ds-100 px-ds-200 py-ds-300",
9
+ };
10
+ const GAP = {
11
+ medium: "gap-ds-150",
12
+ small: "gap-ds-100",
13
+ };
14
+ const TITLE = {
15
+ medium: "text-heading-small",
16
+ small: "text-body-strong",
17
+ };
18
+ const DESCRIPTION = {
19
+ medium: "text-body",
20
+ small: "text-body-small",
21
+ };
22
+ /** The shared layout: icon tile, the message (title, one or two sentences), then the actions. */
23
+ function StateFrame({ slot, icon, isDanger, size, title, headingLevel, description, details, announce, children }) {
24
+ const Title = headingLevel ? `h${headingLevel}` : "span";
25
+ return (_jsxs("div", { "data-slot": slot, "data-size": size,
26
+ // 420px is the design's measure for the message; there is no size token for it.
27
+ className: cn("mx-auto flex w-full max-w-[420px] flex-col items-center text-center text-ds-text", FRAME[size]), children: [_jsx("div", { "data-slot": `${slot}-icon`, className: cn(
28
+ // 24px glyph in the 48px tile; a descendant rule so it outranks the glyph’s own size class.
29
+ "grid size-ds-600 shrink-0 place-items-center rounded-ds-xlarge [&_svg]:size-ds-300", isDanger ? "bg-ds-background-danger" : "bg-ds-surface-sunken"), children: _jsx(IconGlyph, { name: icon, color: isDanger ? "danger" : "subtle" }) }), _jsxs("div", { role: announce ? "alert" : undefined, "data-slot": `${slot}-message`, className: cn("flex flex-col items-center", GAP[size]), children: [_jsx(Title, { "data-slot": `${slot}-title`, className: cn("m-0", TITLE[size]), children: title }), description != null && (_jsx("p", { "data-slot": `${slot}-description`, className: cn("m-0 text-ds-text-subtle", DESCRIPTION[size]), children: description })), details] }), children] }));
30
+ }
31
+ /**
32
+ * Explains why a view has no content, or why it could not be shown, and offers the action that changes that: first
33
+ * use, no results, cleared, or (with `tone="danger"`) a load that failed and its retry. Use it instead of an empty
34
+ * table with only headers.
35
+ */
36
+ export function EmptyState({ icon, title, headingLevel, description, primaryAction, secondaryAction, size = "medium", tone = "neutral", details, announce }) {
37
+ return (_jsx(StateFrame, { slot: "empty-state", icon: icon, isDanger: tone === "danger", size: size, title: title, headingLevel: headingLevel, description: description, details: details, announce: announce, children: (primaryAction != null || secondaryAction != null) && (_jsxs("div", { "data-slot": "empty-state-actions", className: "flex flex-wrap items-center justify-center gap-ds-100", children: [primaryAction, secondaryAction] })) }));
38
+ }
39
+ //# sourceMappingURL=empty-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"empty-state.js","sourceRoot":"","sources":["../../src/feedback/empty-state.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAiB,MAAM,iBAAiB,CAAC;AAI3D,MAAM,KAAK,GAA8B;IACvC,MAAM,EAAE,gCAAgC;IACxC,KAAK,EAAE,gCAAgC;CACxC,CAAC;AACF,MAAM,GAAG,GAA8B;IACrC,MAAM,EAAE,YAAY;IACpB,KAAK,EAAE,YAAY;CACpB,CAAC;AACF,MAAM,KAAK,GAA8B;IACvC,MAAM,EAAE,oBAAoB;IAC5B,KAAK,EAAE,kBAAkB;CAC1B,CAAC;AACF,MAAM,WAAW,GAA8B;IAC7C,MAAM,EAAE,WAAW;IACnB,KAAK,EAAE,iBAAiB;CACzB,CAAC;AAoBF,iGAAiG;AACjG,SAAS,UAAU,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAc;IAC3H,MAAM,KAAK,GAAG,YAAY,CAAC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,UAAU,IACT,IAAI,EAAC,aAAa,EAClB,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,IAAI,KAAK,QAAQ,EAC3B,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,YAEjB,CAAC,aAAa,IAAI,IAAI,IAAI,eAAe,IAAI,IAAI,CAAC,IAAI,CACrD,4BAAe,qBAAqB,EAAC,SAAS,EAAC,uDAAuD,aACnG,aAAa,EACb,eAAe,IACZ,CACP,GACU,CACd,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nimport { cn } from \"../utils\";\nimport { IconGlyph, type IconName } from \"../display/icon\";\n\nexport type StateSize = \"small\" | \"medium\";\n\nconst FRAME: Record<StateSize, string> = {\n medium: \"gap-ds-150 px-ds-300 py-ds-600\",\n small: \"gap-ds-100 px-ds-200 py-ds-300\",\n};\nconst GAP: Record<StateSize, string> = {\n medium: \"gap-ds-150\",\n small: \"gap-ds-100\",\n};\nconst TITLE: Record<StateSize, string> = {\n medium: \"text-heading-small\",\n small: \"text-body-strong\",\n};\nconst DESCRIPTION: Record<StateSize, string> = {\n medium: \"text-body\",\n small: \"text-body-small\",\n};\n\n/** 1 where the state is the whole page (a 404, a page-level error); 2–4 inside a page. */\nexport type StateHeadingLevel = 1 | 2 | 3 | 4;\n\ntype FrameProps = {\n slot: \"empty-state\";\n icon: IconName;\n isDanger?: boolean;\n size: StateSize;\n title: React.ReactNode;\n headingLevel?: StateHeadingLevel;\n description?: React.ReactNode;\n /** Extra message lines (the error code), inside the announced part. */\n details?: React.ReactNode;\n /** Announces the message (title, description, details) as an alert; the actions stay outside it. */\n announce?: boolean;\n children?: React.ReactNode;\n};\n\n/** The shared layout: icon tile, the message (title, one or two sentences), then the actions. */\nfunction StateFrame({ slot, icon, isDanger, size, title, headingLevel, description, details, announce, children }: FrameProps) {\n const Title = headingLevel ? (`h${headingLevel}` as const) : \"span\";\n return (\n <div\n data-slot={slot}\n data-size={size}\n // 420px is the design's measure for the message; there is no size token for it.\n className={cn(\"mx-auto flex w-full max-w-[420px] flex-col items-center text-center text-ds-text\", FRAME[size])}\n >\n <div\n data-slot={`${slot}-icon`}\n className={cn(\n // 24px glyph in the 48px tile; a descendant rule so it outranks the glyph’s own size class.\n \"grid size-ds-600 shrink-0 place-items-center rounded-ds-xlarge [&_svg]:size-ds-300\",\n isDanger ? \"bg-ds-background-danger\" : \"bg-ds-surface-sunken\",\n )}\n >\n <IconGlyph name={icon} color={isDanger ? \"danger\" : \"subtle\"} />\n </div>\n <div role={announce ? \"alert\" : undefined} data-slot={`${slot}-message`} className={cn(\"flex flex-col items-center\", GAP[size])}>\n <Title data-slot={`${slot}-title`} className={cn(\"m-0\", TITLE[size])}>{title}</Title>\n {description != null && (\n <p data-slot={`${slot}-description`} className={cn(\"m-0 text-ds-text-subtle\", DESCRIPTION[size])}>{description}</p>\n )}\n {details}\n </div>\n {children}\n </div>\n );\n}\n\nexport type EmptyStateProps = {\n /** One Lucide icon; no illustrations. */\n icon: IconName;\n /** First use: what will appear here. No results: repeat the query. Cleared: the calm confirmation. */\n title: React.ReactNode;\n /** Renders the title as a heading where the state is the page's main content; a plain line by default. */\n headingLevel?: StateHeadingLevel;\n /** How the content gets here, or the fix; one or two sentences. Never blame the user. */\n description?: React.ReactNode;\n /** The action that fills the view (`Button variant=\"primary\"`), or \"Clear filters\" for no results. */\n primaryAction?: React.ReactNode;\n secondaryAction?: React.ReactNode;\n /** `compact` inside tables and cards. */\n size?: StateSize;\n /** `danger` for a load that failed or a page that is not allowed: the icon in the danger tone. */\n tone?: \"neutral\" | \"danger\";\n /** Extra lines inside the message, under the description: an error code and when it happened, for support. */\n details?: React.ReactNode;\n /**\n * Announce the message (title, description, details) as an alert; the actions stay outside it. For a state that\n * replaces content the user was waiting for (a failed load); not for a first-use or no-results state.\n */\n announce?: boolean;\n};\n\n/**\n * Explains why a view has no content, or why it could not be shown, and offers the action that changes that: first\n * use, no results, cleared, or (with `tone=\"danger\"`) a load that failed and its retry. Use it instead of an empty\n * table with only headers.\n */\nexport function EmptyState({ icon, title, headingLevel, description, primaryAction, secondaryAction, size = \"medium\", tone = \"neutral\", details, announce }: EmptyStateProps) {\n return (\n <StateFrame\n slot=\"empty-state\"\n icon={icon}\n isDanger={tone === \"danger\"}\n size={size}\n title={title}\n headingLevel={headingLevel}\n description={description}\n details={details}\n announce={announce}\n >\n {(primaryAction != null || secondaryAction != null) && (\n <div data-slot=\"empty-state-actions\" className=\"flex flex-wrap items-center justify-center gap-ds-100\">\n {primaryAction}\n {secondaryAction}\n </div>\n )}\n </StateFrame>\n );\n}\n"]}
@@ -0,0 +1,12 @@
1
+ export { Banner } from "./banner.js";
2
+ export type { BannerProps, BannerTone } from "./banner.js";
3
+ export { ProgressBar, ProgressCircle } from "./progress.js";
4
+ export type { ProgressBarProps, ProgressCircleProps, ProgressCircleSize, ProgressTone } from "./progress.js";
5
+ export { Meter } from "./meter.js";
6
+ export type { MeterProps, MeterThresholds } from "./meter.js";
7
+ export { Spinner } from "./spinner.js";
8
+ export type { SpinnerProps, SpinnerSize } from "./spinner.js";
9
+ export { Skeleton, SkeletonGroup } from "./skeleton.js";
10
+ export type { SkeletonGroupProps, SkeletonProps } from "./skeleton.js";
11
+ export { EmptyState } from "./empty-state.js";
12
+ export type { EmptyStateProps, StateHeadingLevel, StateSize } from "./empty-state.js";
@@ -0,0 +1,11 @@
1
+ // @senvenli/react/feedback:
2
+ // Banner, ProgressBar, ProgressCircle, Meter, Spinner and Skeleton on React Aria
3
+ // Components and the theme status tones, plus the resend cooldown
4
+ // pattern; EmptyState (also for a failed load, with tone="danger").
5
+ export { Banner } from "./banner.js";
6
+ export { ProgressBar, ProgressCircle } from "./progress.js";
7
+ export { Meter } from "./meter.js";
8
+ export { Spinner } from "./spinner.js";
9
+ export { Skeleton, SkeletonGroup } from "./skeleton.js";
10
+ export { EmptyState } from "./empty-state.js";
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/feedback/index.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,iFAAiF;AACjF,kEAAkE;AAClE,oEAAoE;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEzD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC","sourcesContent":["// @senvenli/react/feedback:\n// Banner, ProgressBar, ProgressCircle, Meter, Spinner and Skeleton on React Aria\n// Components and the theme status tones, plus the resend cooldown\n// pattern; EmptyState (also for a failed load, with tone=\"danger\").\nexport { Banner } from \"./banner\";\nexport type { BannerProps, BannerTone } from \"./banner\";\nexport { ProgressBar, ProgressCircle } from \"./progress\";\nexport type { ProgressBarProps, ProgressCircleProps, ProgressCircleSize, ProgressTone } from \"./progress\";\nexport { Meter } from \"./meter\";\nexport type { MeterProps, MeterThresholds } from \"./meter\";\nexport { Spinner } from \"./spinner\";\nexport type { SpinnerProps, SpinnerSize } from \"./spinner\";\nexport { Skeleton, SkeletonGroup } from \"./skeleton\";\nexport type { SkeletonGroupProps, SkeletonProps } from \"./skeleton\";\nexport { EmptyState } from \"./empty-state\";\nexport type { EmptyStateProps, StateHeadingLevel, StateSize } from \"./empty-state\";\n"]}
@@ -0,0 +1,33 @@
1
+ import * as React from "react";
2
+ export type MeterThresholds = {
3
+ /** From here the meter warns (orange); default 85% of the maximum when the high end is the bad one. */
4
+ warning?: number;
5
+ /** From here it is critical (red). */
6
+ critical?: number;
7
+ };
8
+ export type MeterProps = {
9
+ label: React.ReactNode;
10
+ value: number;
11
+ maxValue: number;
12
+ /**
13
+ * Which end is the bad one: `high` (quota, usage; default) warns as the value grows,
14
+ * `low` (fuel, credit left) warns as it shrinks.
15
+ */
16
+ badEnd?: "high" | "low";
17
+ /** Segments in the track: 10, or the real unit count (8 for fuel eighths). */
18
+ segments?: number;
19
+ thresholds?: MeterThresholds;
20
+ /**
21
+ * "38 / 50", "460 / 500 · 92%", "1/8 · refill soon": the state in
22
+ * words too, never colour alone. Defaults to "value / max".
23
+ */
24
+ valueLabel?: string;
25
+ };
26
+ /**
27
+ * A measured value against a known maximum (plan quota, fleet usage, fuel).
28
+ * Unlike ProgressBar it does not move toward completion. The track is
29
+ * segmented; from the warning threshold the segments turn orange, at the
30
+ * critical one red, and the value text takes the same colour. `badEnd="low"`
31
+ * turns it around for things that run out (fuel).
32
+ */
33
+ export declare function Meter({ label, value, maxValue, segments, thresholds, badEnd, valueLabel }: MeterProps): React.JSX.Element;
@@ -0,0 +1,42 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { Label, Meter as AriaMeter } from "react-aria-components";
5
+ import { cn } from "../utils.js";
6
+ import { LABEL } from "../form/styles.js";
7
+ function stateOf(value, maxValue, thresholds, badEnd) {
8
+ if (!(maxValue > 0))
9
+ return "normal";
10
+ if (badEnd === "low") {
11
+ if (thresholds?.critical !== undefined && value <= thresholds.critical)
12
+ return "critical";
13
+ return thresholds?.warning !== undefined && value <= thresholds.warning ? "warning" : "normal";
14
+ }
15
+ const warning = thresholds?.warning ?? maxValue * 0.85;
16
+ if (thresholds?.critical !== undefined && value >= thresholds.critical)
17
+ return "critical";
18
+ return value >= warning ? "warning" : "normal";
19
+ }
20
+ const SEGMENT_ON = {
21
+ normal: "bg-ds-chart-1",
22
+ warning: "bg-ds-icon-warning",
23
+ critical: "bg-ds-icon-danger",
24
+ };
25
+ const VALUE_TEXT = {
26
+ normal: "text-ds-text-subtlest",
27
+ warning: "text-ds-text-warning",
28
+ critical: "text-ds-text-danger",
29
+ };
30
+ /**
31
+ * A measured value against a known maximum (plan quota, fleet usage, fuel).
32
+ * Unlike ProgressBar it does not move toward completion. The track is
33
+ * segmented; from the warning threshold the segments turn orange, at the
34
+ * critical one red, and the value text takes the same colour. `badEnd="low"`
35
+ * turns it around for things that run out (fuel).
36
+ */
37
+ export function Meter({ label, value, maxValue, segments = 10, thresholds, badEnd = "high", valueLabel }) {
38
+ const state = stateOf(value, maxValue, thresholds, badEnd);
39
+ const on = maxValue > 0 ? Math.round((Math.min(Math.max(value, 0), maxValue) / maxValue) * segments) : 0;
40
+ return (_jsx(AriaMeter, { value: value, minValue: 0, maxValue: maxValue, valueLabel: valueLabel ?? `${value} / ${maxValue}`, "data-slot": "meter", "data-state": state, className: "flex min-w-0 flex-col gap-ds-075", children: ({ valueText }) => (_jsxs(_Fragment, { children: [_jsxs("div", { "data-slot": "meter-head", className: "flex items-baseline justify-between gap-ds-200", children: [_jsx(Label, { "data-slot": "meter-label", className: LABEL, children: label }), _jsx("span", { "data-slot": "meter-value", className: cn("text-body-small tabular-nums", VALUE_TEXT[state]), children: valueText })] }), _jsx("div", { "data-slot": "meter-track", className: "grid h-2 w-full gap-[2px]", style: { gridTemplateColumns: `repeat(${segments}, minmax(0, 1fr))` }, children: Array.from({ length: segments }, (_, index) => (_jsx("span", { "data-slot": "meter-segment", "data-on": index < on || undefined, className: cn("rounded-ds-xsmall", index < on ? SEGMENT_ON[state] : "bg-ds-background-neutral") }, index))) })] })) }));
41
+ }
42
+ //# sourceMappingURL=meter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meter.js","sourceRoot":"","sources":["../../src/feedback/meter.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,KAAK,IAAI,SAA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CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,0BAA0B,CAAC,IAH1F,KAAK,CAIV,CACH,CAAC,GACE,IACL,CACJ,GACS,CACb,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Label, Meter as AriaMeter } from \"react-aria-components\";\n\nimport { cn } from \"../utils\";\nimport { LABEL } from \"../form/styles\";\n\nexport type MeterThresholds = {\n /** From here the meter warns (orange); default 85% of the maximum when the high end is the bad one. */\n warning?: number;\n /** From here it is critical (red). */\n critical?: number;\n};\n\nexport type MeterProps = {\n label: React.ReactNode;\n value: number;\n maxValue: number;\n /**\n * Which end is the bad one: `high` (quota, usage; default) warns as the value grows,\n * `low` (fuel, credit left) warns as it shrinks.\n */\n badEnd?: \"high\" | \"low\";\n /** Segments in the track: 10, or the real unit count (8 for fuel eighths). */\n segments?: number;\n thresholds?: MeterThresholds;\n /**\n * \"38 / 50\", \"460 / 500 · 92%\", \"1/8 · refill soon\": the state in\n * words too, never colour alone. Defaults to \"value / max\".\n */\n valueLabel?: string;\n};\n\ntype State = \"normal\" | \"warning\" | \"critical\";\n\nfunction stateOf(value: number, maxValue: number, thresholds: MeterThresholds | undefined, badEnd: \"high\" | \"low\"): State {\n if (!(maxValue > 0)) return \"normal\";\n if (badEnd === \"low\") {\n if (thresholds?.critical !== undefined && value <= thresholds.critical) return \"critical\";\n return thresholds?.warning !== undefined && value <= thresholds.warning ? \"warning\" : \"normal\";\n }\n const warning = thresholds?.warning ?? maxValue * 0.85;\n if (thresholds?.critical !== undefined && value >= thresholds.critical) return \"critical\";\n return value >= warning ? \"warning\" : \"normal\";\n}\n\nconst SEGMENT_ON: Record<State, string> = {\n normal: \"bg-ds-chart-1\",\n warning: \"bg-ds-icon-warning\",\n critical: \"bg-ds-icon-danger\",\n};\n\nconst VALUE_TEXT: Record<State, string> = {\n normal: \"text-ds-text-subtlest\",\n warning: \"text-ds-text-warning\",\n critical: \"text-ds-text-danger\",\n};\n\n/**\n * A measured value against a known maximum (plan quota, fleet usage, fuel).\n * Unlike ProgressBar it does not move toward completion. The track is\n * segmented; from the warning threshold the segments turn orange, at the\n * critical one red, and the value text takes the same colour. `badEnd=\"low\"`\n * turns it around for things that run out (fuel).\n */\nexport function Meter({ label, value, maxValue, segments = 10, thresholds, badEnd = \"high\", valueLabel }: MeterProps) {\n const state = stateOf(value, maxValue, thresholds, badEnd);\n const on = maxValue > 0 ? Math.round((Math.min(Math.max(value, 0), maxValue) / maxValue) * segments) : 0;\n return (\n <AriaMeter\n value={value}\n minValue={0}\n maxValue={maxValue}\n valueLabel={valueLabel ?? `${value} / ${maxValue}`}\n data-slot=\"meter\"\n data-state={state}\n className=\"flex min-w-0 flex-col gap-ds-075\"\n >\n {({ valueText }) => (\n <>\n <div data-slot=\"meter-head\" className=\"flex items-baseline justify-between gap-ds-200\">\n <Label data-slot=\"meter-label\" className={LABEL}>{label}</Label>\n <span data-slot=\"meter-value\" className={cn(\"text-body-small tabular-nums\", VALUE_TEXT[state])}>{valueText}</span>\n </div>\n <div data-slot=\"meter-track\" className=\"grid h-2 w-full gap-[2px]\" style={{ gridTemplateColumns: `repeat(${segments}, minmax(0, 1fr))` }}>\n {Array.from({ length: segments }, (_, index) => (\n <span\n key={index}\n data-slot=\"meter-segment\"\n data-on={index < on || undefined}\n className={cn(\"rounded-ds-xsmall\", index < on ? SEGMENT_ON[state] : \"bg-ds-background-neutral\")}\n />\n ))}\n </div>\n </>\n )}\n </AriaMeter>\n );\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import * as React from "react";
2
+ /** True when motion should be reduced: the device asks for it, or the app's motion setting in effect is reduce/none. */
3
+ export declare function usePrefersReducedMotion(): boolean;
4
+ /**
5
+ * A looping animation through the Web Animations API, so the design system
6
+ * needs no global keyframes; it does not run under reduced motion (or where
7
+ * the API does not exist).
8
+ */
9
+ export declare function useLoop(ref: React.RefObject<HTMLElement | null>, keyframes: Keyframe[] | ((direction: "ltr" | "rtl") => Keyframe[]), duration: number, enabled: boolean, easing?: "ease-in-out" | "linear"): boolean;