@senvenli/react 0.0.0-stage → 0.2.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,54 @@
1
+ import * as React from "react";
2
+ import type { CarouselItem } from "./carousel.js";
3
+ /**
4
+ * The image renderer an app may inject (next/image's props are a superset), so the package carries no
5
+ * framework dependency; a plain `<img>` by default.
6
+ */
7
+ export interface ImageViewerImageProps {
8
+ src: string;
9
+ alt: string;
10
+ className?: string;
11
+ width?: number;
12
+ height?: number;
13
+ fill?: boolean;
14
+ sizes?: string;
15
+ priority?: boolean;
16
+ preload?: boolean;
17
+ "aria-hidden"?: boolean | "true" | "false";
18
+ }
19
+ export type ImageViewerImage = React.ComponentType<ImageViewerImageProps>;
20
+ /** Wrap an index into [0, total) so prev/next cycle instead of dead-ending. */
21
+ export declare function wrapPhotoIndex(index: number, total: number): number;
22
+ export interface ImageViewerProps {
23
+ /** The image renderer (e.g. next/image); a plain `<img>` by default. */
24
+ image?: ImageViewerImage;
25
+ /** The photos in display order, each with its own alt text: the same shape as Carousel's `items`. */
26
+ items: CarouselItem[];
27
+ /** The photo to open on; wrapped into range. */
28
+ defaultIndex?: number;
29
+ /** Open by default, so rendering it opens it; or control it with `onOpenChange`. */
30
+ isOpen?: boolean;
31
+ /** Called with `false` on Esc, the close button or a press on the scrim. */
32
+ onOpenChange?: (isOpen: boolean) => void;
33
+ /** Caption shown at the bottom and used as the accessible dialog title. */
34
+ title: string;
35
+ /** The viewer's words; the DS strings by default ("Close", "Previous image", "Next image", "Image 2 of 5"). */
36
+ labels?: {
37
+ close?: string;
38
+ previous?: string;
39
+ next?: string;
40
+ position?: (index: number, total: number) => string;
41
+ };
42
+ }
43
+ /**
44
+ * Full-screen photo viewing for the media family.
45
+ *
46
+ * A dark modal with the photo contained, previous/next that cycle, arrow keys, a position caption and a
47
+ * filmstrip under the stage. The viewer is dark in both themes (`data-theme="dark"` on the modal, so every
48
+ * color is still a `--ds-*` token). Esc and a scrim press close it; focus stays inside while open and
49
+ * returns to what opened it. In right-to-left the controls mirror and → / ← follow the reading direction.
50
+ *
51
+ * An app may inject its image renderer (next/image), a src resolver and its own labels; by default it
52
+ * renders plain `<img>` elements with the DS strings. Do not add a second public lightbox next to this.
53
+ */
54
+ export declare function ImageViewer({ image: Image, items: photos, defaultIndex, isOpen, onOpenChange, title, labels, }: ImageViewerProps): React.JSX.Element | null;
@@ -0,0 +1,84 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { Button as AriaButton, Dialog as AriaDialog, Heading, Modal, ModalOverlay, useLocale, } from "react-aria-components";
5
+ import { closeLabel as dsCloseLabel, imagePositionLabel, nextImageLabel, previousImageLabel } from "../i18n.js";
6
+ import { cn } from "../utils.js";
7
+ import { IconGlyph } from "./icon.js";
8
+ /** The default renderer: a plain `<img>`; `fill` covers the positioned parent. */
9
+ function PlainImage({ src, alt, className, width, height, fill, sizes, priority, preload, "aria-hidden": ariaHidden }) {
10
+ return (_jsx("img", { src: src, alt: alt, width: width, height: height, sizes: sizes, "aria-hidden": ariaHidden, loading: priority || preload ? "eager" : "lazy", decoding: "async", className: cn(fill && "absolute inset-0 size-full", className) }));
11
+ }
12
+ /** Wrap an index into [0, total) so prev/next cycle instead of dead-ending. */
13
+ export function wrapPhotoIndex(index, total) {
14
+ if (total <= 0)
15
+ return 0;
16
+ return (index + total) % total;
17
+ }
18
+ function isEditableTarget(target) {
19
+ if (!(target instanceof HTMLElement))
20
+ return false;
21
+ return Boolean(target.closest("input, textarea, select, [contenteditable='true']"));
22
+ }
23
+ /** Round controls over the photo, as the Carousel's: the overlay surface of the (always dark) viewer. */
24
+ const ROUND_BUTTON = "grid cursor-pointer place-items-center rounded-ds-full bg-ds-surface-overlay text-ds-icon shadow-ds-overlay outline-hidden " +
25
+ "data-[hovered]:bg-ds-surface-hovered data-[focus-visible]:inset-ring-2 data-[focus-visible]:inset-ring-ds-border-focused";
26
+ /**
27
+ * Full-screen photo viewing for the media family.
28
+ *
29
+ * A dark modal with the photo contained, previous/next that cycle, arrow keys, a position caption and a
30
+ * filmstrip under the stage. The viewer is dark in both themes (`data-theme="dark"` on the modal, so every
31
+ * color is still a `--ds-*` token). Esc and a scrim press close it; focus stays inside while open and
32
+ * returns to what opened it. In right-to-left the controls mirror and → / ← follow the reading direction.
33
+ *
34
+ * An app may inject its image renderer (next/image), a src resolver and its own labels; by default it
35
+ * renders plain `<img>` elements with the DS strings. Do not add a second public lightbox next to this.
36
+ */
37
+ export function ImageViewer({ image: Image = PlainImage, items: photos, defaultIndex = 0, isOpen = true, onOpenChange, title, labels, }) {
38
+ const { direction, locale } = useLocale();
39
+ const positionLabel = labels?.position ?? ((n, total) => imagePositionLabel(locale, n, total));
40
+ const closeLabel = labels?.close ?? dsCloseLabel(locale);
41
+ const previousLabel = labels?.previous ?? previousImageLabel(locale);
42
+ const nextLabel = labels?.next ?? nextImageLabel(locale);
43
+ const [index, setIndex] = React.useState(() => wrapPhotoIndex(defaultIndex, photos.length));
44
+ const currentPhoto = photos[index];
45
+ const stripRef = React.useRef(null);
46
+ const descriptionId = React.useId();
47
+ const move = React.useCallback((delta) => setIndex((current) => wrapPhotoIndex(current + delta, photos.length)), [photos.length]);
48
+ // Listen at document capture level while the viewer is open, so physical arrow keys never depend on where
49
+ // focus sits in the overlay. Editable controls keep their native cursor behavior.
50
+ React.useEffect(() => {
51
+ if (!isOpen || photos.length <= 1)
52
+ return;
53
+ const handleKeyDown = (event) => {
54
+ if (isEditableTarget(event.target))
55
+ return;
56
+ const back = direction === "rtl" ? "ArrowRight" : "ArrowLeft";
57
+ const forward = direction === "rtl" ? "ArrowLeft" : "ArrowRight";
58
+ if (event.key === back) {
59
+ event.preventDefault();
60
+ move(-1);
61
+ }
62
+ else if (event.key === forward) {
63
+ event.preventDefault();
64
+ move(1);
65
+ }
66
+ };
67
+ document.addEventListener("keydown", handleKeyDown, true);
68
+ return () => document.removeEventListener("keydown", handleKeyDown, true);
69
+ }, [move, photos.length, direction, isOpen]);
70
+ // The strip follows the open photo, so on a long gallery it keeps saying where you are.
71
+ React.useEffect(() => {
72
+ const thumb = stripRef.current?.children[index];
73
+ // Optional call: jsdom has no scrollIntoView.
74
+ thumb?.scrollIntoView?.({ block: "nearest", inline: "center" });
75
+ }, [index]);
76
+ if (!currentPhoto)
77
+ return null;
78
+ const position = positionLabel(index + 1, photos.length);
79
+ return (_jsx(ModalOverlay, { isOpen: isOpen, isDismissable: true, onOpenChange: (open) => onOpenChange?.(open), "data-slot": "image-viewer-overlay", className: "fixed inset-0 z-50 grid place-items-center bg-ds-blanket p-ds-100", children: _jsx(Modal, { "data-theme": "dark", "data-slot": "image-viewer", className: "w-full max-w-[calc(100vw-1rem)] overflow-hidden rounded-ds-xlarge bg-ds-surface text-ds-text shadow-ds-overlay outline-hidden sm:max-w-5xl", children: _jsx(AriaDialog, { "aria-describedby": descriptionId, className: "flex flex-col outline-hidden", children: ({ close }) => (_jsxs(_Fragment, { children: [_jsx(Heading, { slot: "title", className: "sr-only", children: title }), _jsx("p", { id: descriptionId, className: "sr-only", children: position }), _jsxs("div", { "data-slot": "image-viewer-stage", className: "relative flex min-h-[min(72dvh,48rem)] items-center justify-center bg-ds-surface-sunken", children: [_jsx(Image, { src: currentPhoto.src, alt: currentPhoto.alt, fill: true, preload: true, sizes: "100vw", className: "object-contain" }, currentPhoto.id ?? currentPhoto.src), _jsx(AriaButton, { "data-slot": "image-viewer-close", "aria-label": closeLabel, onPress: close, className: cn(ROUND_BUTTON, "absolute top-ds-150 end-ds-150 z-10 size-8"), children: _jsx(IconGlyph, { name: "x" }) }), photos.length > 1 && (_jsxs(_Fragment, { children: [_jsx(AriaButton, { "data-slot": "image-viewer-previous", "aria-label": previousLabel, onPress: () => move(-1), className: cn(ROUND_BUTTON, "absolute start-ds-150 z-10 size-10"), children: _jsx(IconGlyph, { name: "chevron-left", size: "large" }) }), _jsx(AriaButton, { "data-slot": "image-viewer-next", "aria-label": nextLabel, onPress: () => move(1), className: cn(ROUND_BUTTON, "absolute end-ds-150 z-10 size-10"), children: _jsx(IconGlyph, { name: "chevron-right", size: "large" }) })] })), _jsx("div", { "data-slot": "image-viewer-caption", className: "absolute inset-x-0 bottom-0 z-10 flex items-end bg-linear-to-t from-ds-blanket to-transparent px-ds-200 pt-ds-800 pb-ds-200 sm:px-ds-250 sm:pb-ds-250", children: _jsxs("div", { className: "min-w-0", children: [_jsx("p", { dir: "auto", className: "truncate text-body-strong text-ds-text", children: title }), _jsx("p", { dir: "auto", className: "mt-ds-025 text-body-small text-ds-text-subtle tabular-nums", children: position })] }) })] }), photos.length > 1 && (_jsx("div", { ref: stripRef, "data-slot": "image-viewer-strip", className: "flex gap-ds-100 overflow-x-auto bg-ds-surface px-ds-200 py-ds-150 sm:px-ds-250", children: photos.map((photo, thumb) => {
80
+ const active = thumb === index;
81
+ return (_jsx(AriaButton, { "data-slot": "image-viewer-thumbnail", "aria-label": positionLabel(thumb + 1, photos.length), "aria-current": active, onPress: () => setIndex(thumb), className: cn("relative aspect-[4/3] h-14 w-auto shrink-0 cursor-pointer overflow-hidden rounded-ds-medium bg-ds-surface-sunken p-0 outline-hidden", "motion-safe:transition-opacity motion-safe:duration-(--ds-duration-fast)", "after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit]", active ? "after:inset-ring-2 after:inset-ring-ds-border-selected" : "opacity-55 data-[hovered]:opacity-100", "before:pointer-events-none before:absolute before:inset-[3px] before:z-[1] before:rounded-[max(0px,calc(var(--ds-radius-medium)-3px))]", "data-[focus-visible]:opacity-100 data-[focus-visible]:before:inset-ring-2 data-[focus-visible]:before:inset-ring-ds-border-focused"), children: _jsx(Image, { src: photo.src, alt: "", fill: true, sizes: "96px", className: "object-cover" }) }, `${photo.id ?? photo.src}-${thumb}`));
82
+ }) }))] })) }) }) }));
83
+ }
84
+ //# sourceMappingURL=image-viewer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-viewer.js","sourceRoot":"","sources":["../../src/display/image-viewer.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,MAAM,IAAI,UAAU,EACpB,MAAM,IAAI,UAAU,EACpB,OAAO,EACP,KAAK,EACL,YAAY,EACZ,SAAS,GACV,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,UAAU,IAAI,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7G,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAsBnC,kFAAkF;AAClF,SAAS,UAAU,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAyB;IAC1I,OAAO,CACL,cACE,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,iBACC,UAAU,EACvB,OAAO,EAAE,QAAQ,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAC/C,QAAQ,EAAC,OAAO,EAChB,SAAS,EAAE,EAAE,CAAC,I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G,EAAC,MAAM,EAAC,SAAS,EAAC,4DAA4D,YAAE,QAAQ,GAAK,IAC/F,GACF,IACF,EAGL,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,CACpB,cAAK,GAAG,EAAE,QAAQ,eAAY,oBAAoB,EAAC,SAAS,EAAC,gFAAgF,YAC1I,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;gCAC3B,MAAM,MAAM,GAAG,KAAK,KAAK,KAAK,CAAC;gCAC/B,OAAO,CACL,KAAC,UAAU,iBAEC,wBAAwB,gBAEtB,aAAa,CAAC,KAAK,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,kBACrC,MAAM,EACpB,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,EAC9B,SAAS,EAAE,EAAE,CACX,qIAAqI,EACrI,0EAA0E,EAC1E,gFAAgF,EAChF,MAAM,CAAC,CAAC,CAAC,wDAAwD,CAAC,CAAC,CAAC,uCAAuC,EAC3G,wIAAwI,EACxI,oIAAoI,CACrI,YAED,KAAC,KAAK,IAAC,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,EAAC,EAAE,EAAC,IAAI,QAAC,KAAK,EAAC,MAAM,EAAC,SAAS,EAAC,cAAc,GAAG,IAftE,GAAG,KAAK,CAAC,EAAE,IAAI,KAAK,CAAC,GAAG,IAAI,KAAK,EAAE,CAgB7B,CACd,CAAC;4BACJ,CAAC,CAAC,GACE,CACP,IACA,CACJ,GACU,GACP,GACK,CAChB,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport {\n Button as AriaButton,\n Dialog as AriaDialog,\n Heading,\n Modal,\n ModalOverlay,\n useLocale,\n} from \"react-aria-components\";\n\nimport { closeLabel as dsCloseLabel, imagePositionLabel, nextImageLabel, previousImageLabel } from \"../i18n\";\nimport { cn } from \"../utils\";\nimport { IconGlyph } from \"./icon\";\nimport type { CarouselItem } from \"./carousel\";\n\n/**\n * The image renderer an app may inject (next/image's props are a superset), so the package carries no\n * framework dependency; a plain `<img>` by default.\n */\nexport interface ImageViewerImageProps {\n src: string;\n alt: string;\n className?: string;\n width?: number;\n height?: number;\n fill?: boolean;\n sizes?: string;\n priority?: boolean;\n preload?: boolean;\n \"aria-hidden\"?: boolean | \"true\" | \"false\";\n}\n\nexport type ImageViewerImage = React.ComponentType<ImageViewerImageProps>;\n\n/** The default renderer: a plain `<img>`; `fill` covers the positioned parent. */\nfunction PlainImage({ src, alt, className, width, height, fill, sizes, priority, preload, \"aria-hidden\": ariaHidden }: ImageViewerImageProps) {\n return (\n <img\n src={src}\n alt={alt}\n width={width}\n height={height}\n sizes={sizes}\n aria-hidden={ariaHidden}\n loading={priority || preload ? \"eager\" : \"lazy\"}\n decoding=\"async\"\n className={cn(fill && \"absolute inset-0 size-full\", className)}\n />\n );\n}\n\n/** Wrap an index into [0, total) so prev/next cycle instead of dead-ending. */\nexport function wrapPhotoIndex(index: number, total: number) {\n if (total <= 0) return 0;\n return (index + total) % total;\n}\n\nfunction isEditableTarget(target: EventTarget | null) {\n if (!(target instanceof HTMLElement)) return false;\n return Boolean(target.closest(\"input, textarea, select, [contenteditable='true']\"));\n}\n\nexport interface ImageViewerProps {\n /** The image renderer (e.g. next/image); a plain `<img>` by default. */\n image?: ImageViewerImage;\n /** The photos in display order, each with its own alt text: the same shape as Carousel's `items`. */\n items: CarouselItem[];\n /** The photo to open on; wrapped into range. */\n defaultIndex?: number;\n /** Open by default, so rendering it opens it; or control it with `onOpenChange`. */\n isOpen?: boolean;\n /** Called with `false` on Esc, the close button or a press on the scrim. */\n onOpenChange?: (isOpen: boolean) => void;\n /** Caption shown at the bottom and used as the accessible dialog title. */\n title: string;\n /** The viewer's words; the DS strings by default (\"Close\", \"Previous image\", \"Next image\", \"Image 2 of 5\"). */\n labels?: {\n close?: string;\n previous?: string;\n next?: string;\n position?: (index: number, total: number) => string;\n };\n}\n\n/** Round controls over the photo, as the Carousel's: the overlay surface of the (always dark) viewer. */\nconst ROUND_BUTTON =\n \"grid cursor-pointer place-items-center rounded-ds-full bg-ds-surface-overlay text-ds-icon shadow-ds-overlay outline-hidden \" +\n \"data-[hovered]:bg-ds-surface-hovered data-[focus-visible]:inset-ring-2 data-[focus-visible]:inset-ring-ds-border-focused\";\n\n/**\n * Full-screen photo viewing for the media family.\n *\n * A dark modal with the photo contained, previous/next that cycle, arrow keys, a position caption and a\n * filmstrip under the stage. The viewer is dark in both themes (`data-theme=\"dark\"` on the modal, so every\n * color is still a `--ds-*` token). Esc and a scrim press close it; focus stays inside while open and\n * returns to what opened it. In right-to-left the controls mirror and → / ← follow the reading direction.\n *\n * An app may inject its image renderer (next/image), a src resolver and its own labels; by default it\n * renders plain `<img>` elements with the DS strings. Do not add a second public lightbox next to this.\n */\nexport function ImageViewer({\n image: Image = PlainImage,\n items: photos,\n defaultIndex = 0,\n isOpen = true,\n onOpenChange,\n title,\n labels,\n}: ImageViewerProps) {\n const { direction, locale } = useLocale();\n const positionLabel = labels?.position ?? ((n: number, total: number) => imagePositionLabel(locale, n, total));\n const closeLabel = labels?.close ?? dsCloseLabel(locale);\n const previousLabel = labels?.previous ?? previousImageLabel(locale);\n const nextLabel = labels?.next ?? nextImageLabel(locale);\n const [index, setIndex] = React.useState(() => wrapPhotoIndex(defaultIndex, photos.length));\n const currentPhoto = photos[index];\n const stripRef = React.useRef<HTMLDivElement>(null);\n const descriptionId = React.useId();\n const move = React.useCallback(\n (delta: number) => setIndex((current) => wrapPhotoIndex(current + delta, photos.length)),\n [photos.length],\n );\n\n // Listen at document capture level while the viewer is open, so physical arrow keys never depend on where\n // focus sits in the overlay. Editable controls keep their native cursor behavior.\n React.useEffect(() => {\n if (!isOpen || photos.length <= 1) return;\n const handleKeyDown = (event: KeyboardEvent) => {\n if (isEditableTarget(event.target)) return;\n const back = direction === \"rtl\" ? \"ArrowRight\" : \"ArrowLeft\";\n const forward = direction === \"rtl\" ? \"ArrowLeft\" : \"ArrowRight\";\n if (event.key === back) {\n event.preventDefault();\n move(-1);\n } else if (event.key === forward) {\n event.preventDefault();\n move(1);\n }\n };\n document.addEventListener(\"keydown\", handleKeyDown, true);\n return () => document.removeEventListener(\"keydown\", handleKeyDown, true);\n }, [move, photos.length, direction, isOpen]);\n\n // The strip follows the open photo, so on a long gallery it keeps saying where you are.\n React.useEffect(() => {\n const thumb = stripRef.current?.children[index] as HTMLElement | undefined;\n // Optional call: jsdom has no scrollIntoView.\n thumb?.scrollIntoView?.({ block: \"nearest\", inline: \"center\" });\n }, [index]);\n\n if (!currentPhoto) return null;\n const position = positionLabel(index + 1, photos.length);\n\n return (\n <ModalOverlay\n isOpen={isOpen}\n isDismissable\n onOpenChange={(open) => onOpenChange?.(open)}\n data-slot=\"image-viewer-overlay\"\n className=\"fixed inset-0 z-50 grid place-items-center bg-ds-blanket p-ds-100\"\n >\n <Modal\n data-theme=\"dark\"\n data-slot=\"image-viewer\"\n className=\"w-full max-w-[calc(100vw-1rem)] overflow-hidden rounded-ds-xlarge bg-ds-surface text-ds-text shadow-ds-overlay outline-hidden sm:max-w-5xl\"\n >\n <AriaDialog aria-describedby={descriptionId} className=\"flex flex-col outline-hidden\">\n {({ close }) => (\n <>\n <Heading slot=\"title\" className=\"sr-only\">{title}</Heading>\n <p id={descriptionId} className=\"sr-only\">{position}</p>\n\n <div data-slot=\"image-viewer-stage\" className=\"relative flex min-h-[min(72dvh,48rem)] items-center justify-center bg-ds-surface-sunken\">\n {/* Next 16 renamed next/image `priority` to `preload` (same effect: eager load plus a preload hint). Thumbnails take neither. */}\n <Image key={currentPhoto.id ?? currentPhoto.src} src={currentPhoto.src} alt={currentPhoto.alt} fill preload sizes=\"100vw\" className=\"object-contain\" />\n\n <AriaButton\n data-slot=\"image-viewer-close\"\n aria-label={closeLabel}\n onPress={close}\n className={cn(ROUND_BUTTON, \"absolute top-ds-150 end-ds-150 z-10 size-8\")}\n >\n <IconGlyph name=\"x\" />\n </AriaButton>\n\n {photos.length > 1 && (\n <>\n <AriaButton\n data-slot=\"image-viewer-previous\"\n aria-label={previousLabel}\n onPress={() => move(-1)}\n className={cn(ROUND_BUTTON, \"absolute start-ds-150 z-10 size-10\")}\n >\n <IconGlyph name=\"chevron-left\" size=\"large\" />\n </AriaButton>\n <AriaButton\n data-slot=\"image-viewer-next\"\n aria-label={nextLabel}\n onPress={() => move(1)}\n className={cn(ROUND_BUTTON, \"absolute end-ds-150 z-10 size-10\")}\n >\n <IconGlyph name=\"chevron-right\" size=\"large\" />\n </AriaButton>\n </>\n )}\n\n <div\n data-slot=\"image-viewer-caption\"\n className=\"absolute inset-x-0 bottom-0 z-10 flex items-end bg-linear-to-t from-ds-blanket to-transparent px-ds-200 pt-ds-800 pb-ds-200 sm:px-ds-250 sm:pb-ds-250\"\n >\n <div className=\"min-w-0\">\n <p dir=\"auto\" className=\"truncate text-body-strong text-ds-text\">{title}</p>\n {/* dir=\"auto\": the caption's own script sets its order, so \"2 / 3\" never reads \"3 / 2\" on an RTL page. */}\n <p dir=\"auto\" className=\"mt-ds-025 text-body-small text-ds-text-subtle tabular-nums\">{position}</p>\n </div>\n </div>\n </div>\n\n {/* The filmstrip sits under the stage rather than over it: this viewer's whole job is the photo. */}\n {photos.length > 1 && (\n <div ref={stripRef} data-slot=\"image-viewer-strip\" className=\"flex gap-ds-100 overflow-x-auto bg-ds-surface px-ds-200 py-ds-150 sm:px-ds-250\">\n {photos.map((photo, thumb) => {\n const active = thumb === index;\n return (\n <AriaButton\n key={`${photo.id ?? photo.src}-${thumb}`}\n data-slot=\"image-viewer-thumbnail\"\n // Named by the position caption the viewer already requires, so the strip costs no new prop.\n aria-label={positionLabel(thumb + 1, photos.length)}\n aria-current={active}\n onPress={() => setIndex(thumb)}\n className={cn(\n \"relative aspect-[4/3] h-14 w-auto shrink-0 cursor-pointer overflow-hidden rounded-ds-medium bg-ds-surface-sunken p-0 outline-hidden\",\n \"motion-safe:transition-opacity motion-safe:duration-(--ds-duration-fast)\",\n \"after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit]\",\n active ? \"after:inset-ring-2 after:inset-ring-ds-border-selected\" : \"opacity-55 data-[hovered]:opacity-100\",\n \"before:pointer-events-none before:absolute before:inset-[3px] before:z-[1] before:rounded-[max(0px,calc(var(--ds-radius-medium)-3px))]\",\n \"data-[focus-visible]:opacity-100 data-[focus-visible]:before:inset-ring-2 data-[focus-visible]:before:inset-ring-ds-border-focused\",\n )}\n >\n <Image src={photo.src} alt=\"\" fill sizes=\"96px\" className=\"object-cover\" />\n </AriaButton>\n );\n })}\n </div>\n )}\n </>\n )}\n </AriaDialog>\n </Modal>\n </ModalOverlay>\n );\n}\n"]}
@@ -0,0 +1,26 @@
1
+ import * as React from "react";
2
+ import { type ComponentRadius } from "../defaults.js";
3
+ export type ImageProps = {
4
+ src: string;
5
+ /** What the picture shows ("A red bicycle against a white wall"); `""` for a purely decorative one. */
6
+ alt: string;
7
+ /**
8
+ * Width to height ("16/9", "4/3", "1/1", or a number like 1.5): the box keeps it before the picture loads, so the
9
+ * page never jumps. Left out, the picture's own shape.
10
+ */
11
+ ratio?: string | number;
12
+ /** `cover` (default) fills the box and crops; `contain` shows all of it, with space around. */
13
+ fit?: "cover" | "contain";
14
+ radius?: ComponentRadius;
15
+ /** Shown when the picture cannot load; a neutral tile with an image icon by default. */
16
+ fallback?: React.ReactNode;
17
+ /** `lazy` (default) loads it when it nears the screen; `eager` for the picture above the fold. */
18
+ loading?: "lazy" | "eager";
19
+ width?: number;
20
+ height?: number;
21
+ };
22
+ /**
23
+ * A picture in a box that keeps its shape (`ratio`) while it loads, with a fallback when it cannot load. For a
24
+ * person use Avatar; for a gallery, Carousel or ImageViewer.
25
+ */
26
+ export declare function Image({ src, alt, ratio, fit, radius: radiusProp, fallback, loading, width, height }: ImageProps): React.JSX.Element;
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { cn } from "../utils.js";
5
+ import { radiusClass, useRadius } from "../defaults.js";
6
+ import { IconGlyph } from "./icon.js";
7
+ /**
8
+ * A picture in a box that keeps its shape (`ratio`) while it loads, with a fallback when it cannot load. For a
9
+ * person use Avatar; for a gallery, Carousel or ImageViewer.
10
+ */
11
+ export function Image({ src, alt, ratio, fit = "cover", radius: radiusProp, fallback, loading = "lazy", width, height }) {
12
+ const radius = useRadius(radiusProp);
13
+ const [failed, setFailed] = React.useState(false);
14
+ React.useEffect(() => setFailed(false), [src]);
15
+ return (_jsx("span", { "data-slot": "image", "data-failed": failed || undefined, className: cn("relative block overflow-hidden rounded-ds-medium bg-ds-background-neutral", radiusClass(radius)), style: ratio !== undefined ? { aspectRatio: String(ratio) } : undefined, children: failed ? (_jsx("span", { "data-slot": "image-fallback", role: alt ? "img" : undefined, "aria-label": alt || undefined, className: "absolute inset-0 grid place-items-center text-ds-icon-subtle", children: fallback ?? _jsx(IconGlyph, { name: "image-off", size: "large" }) })) : (_jsx("img", { src: src, alt: alt, loading: loading, width: width, height: height, onError: () => setFailed(true), className: cn("block size-full", ratio !== undefined && "absolute inset-0", fit === "contain" ? "object-contain" : "object-cover") })) }));
16
+ }
17
+ //# sourceMappingURL=image.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image.js","sourceRoot":"","sources":["../../src/display/image.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,WAAW,EAAE,SAAS,EAAwB,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAsBnC;;;GAGG;AACH,MAAM,UAAU,KAAK,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,GAAG,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM,EAAE,K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\"react\";\n\nimport { cn } from \"../utils\";\nimport { radiusClass, useRadius, type ComponentRadius } from \"../defaults\";\nimport { IconGlyph } from \"./icon\";\n\nexport type ImageProps = {\n src: string;\n /** What the picture shows (\"A red bicycle against a white wall\"); `\"\"` for a purely decorative one. */\n alt: string;\n /**\n * Width to height (\"16/9\", \"4/3\", \"1/1\", or a number like 1.5): the box keeps it before the picture loads, so the\n * page never jumps. Left out, the picture's own shape.\n */\n ratio?: string | number;\n /** `cover` (default) fills the box and crops; `contain` shows all of it, with space around. */\n fit?: \"cover\" | \"contain\";\n radius?: ComponentRadius;\n /** Shown when the picture cannot load; a neutral tile with an image icon by default. */\n fallback?: React.ReactNode;\n /** `lazy` (default) loads it when it nears the screen; `eager` for the picture above the fold. */\n loading?: \"lazy\" | \"eager\";\n width?: number;\n height?: number;\n};\n\n/**\n * A picture in a box that keeps its shape (`ratio`) while it loads, with a fallback when it cannot load. For a\n * person use Avatar; for a gallery, Carousel or ImageViewer.\n */\nexport function Image({ src, alt, ratio, fit = \"cover\", radius: radiusProp, fallback, loading = \"lazy\", width, height }: ImageProps) {\n const radius = useRadius(radiusProp);\n const [failed, setFailed] = React.useState(false);\n React.useEffect(() => setFailed(false), [src]);\n return (\n <span\n data-slot=\"image\"\n data-failed={failed || undefined}\n className={cn(\"relative block overflow-hidden rounded-ds-medium bg-ds-background-neutral\", radiusClass(radius))}\n style={ratio !== undefined ? { aspectRatio: String(ratio) } : undefined}\n >\n {failed ? (\n <span data-slot=\"image-fallback\" role={alt ? \"img\" : undefined} aria-label={alt || undefined} className=\"absolute inset-0 grid place-items-center text-ds-icon-subtle\">\n {fallback ?? <IconGlyph name=\"image-off\" size=\"large\" />}\n </span>\n ) : (\n <img\n src={src}\n alt={alt}\n loading={loading}\n width={width}\n height={height}\n onError={() => setFailed(true)}\n className={cn(\"block size-full\", ratio !== undefined && \"absolute inset-0\", fit === \"contain\" ? \"object-contain\" : \"object-cover\")}\n />\n )}\n </span>\n );\n}\n"]}
@@ -0,0 +1,29 @@
1
+ export { Icon } from "./icon.js";
2
+ export type { IconProps } from "./icon.js";
3
+ export type { IconColor, IconName, IconSize } from "./icon-names.js";
4
+ export { Card, CardBody, CardFooter, CardHeader, CardMedia } from "./card.js";
5
+ export type { CardHeaderProps, CardHeadingLevel, CardMediaProps, CardProps, CardVariant } from "./card.js";
6
+ export { Avatar, AvatarGroup } from "./avatar.js";
7
+ export type { AvatarGroupProps, AvatarProps, AvatarShape, AvatarSize } from "./avatar.js";
8
+ export { Badge, BadgeAnchor } from "./badge.js";
9
+ export type { BadgeCountProps, BadgeCountTone, BadgeProps, BadgeStatusProps, BadgeTone, BadgeVariant } from "./badge.js";
10
+ export { Separator } from "./separator.js";
11
+ export type { SeparatorProps } from "./separator.js";
12
+ export { Kbd } from "./kbd.js";
13
+ export type { KbdProps } from "./kbd.js";
14
+ export { Heading, Prose, Text } from "./typography.js";
15
+ export type { HeadingLevel, HeadingProps, HeadingSize, TextProps, TextSize, TextTone } from "./typography.js";
16
+ export { Stat, StatGroup } from "./stat.js";
17
+ export type { StatDelta, StatProps } from "./stat.js";
18
+ export { DescriptionList } from "./description-list.js";
19
+ export type { DescriptionListItem, DescriptionListProps } from "./description-list.js";
20
+ export { Timeline } from "./timeline.js";
21
+ export type { TimelineItem, TimelineProps, TimelineTone } from "./timeline.js";
22
+ export { Carousel, CarouselSlide } from "./carousel.js";
23
+ export type { CarouselItem, CarouselProps, CarouselSlideProps } from "./carousel.js";
24
+ export { ImageViewer, wrapPhotoIndex } from "./image-viewer.js";
25
+ export type { ImageViewerImage, ImageViewerImageProps, ImageViewerProps } from "./image-viewer.js";
26
+ export { VisuallyHidden } from "./visually-hidden.js";
27
+ export type { VisuallyHiddenProps } from "./visually-hidden.js";
28
+ export { Image } from "./image.js";
29
+ export type { ImageProps } from "./image.js";
@@ -0,0 +1,16 @@
1
+ // Icon: every Lucide icon by name, shipped with the package; apps never import lucide-react.
2
+ export { Icon } from "./icon.js";
3
+ export { Card, CardBody, CardFooter, CardHeader, CardMedia } from "./card.js";
4
+ export { Avatar, AvatarGroup } from "./avatar.js";
5
+ export { Badge, BadgeAnchor } from "./badge.js";
6
+ export { Separator } from "./separator.js";
7
+ export { Kbd } from "./kbd.js";
8
+ export { Heading, Prose, Text } from "./typography.js";
9
+ export { Stat, StatGroup } from "./stat.js";
10
+ export { DescriptionList } from "./description-list.js";
11
+ export { Timeline } from "./timeline.js";
12
+ export { Carousel, CarouselSlide } from "./carousel.js";
13
+ export { ImageViewer, wrapPhotoIndex } from "./image-viewer.js";
14
+ export { VisuallyHidden } from "./visually-hidden.js";
15
+ export { Image } from "./image.js";
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/display/index.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAG9B,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAE3E,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE/C,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEzC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAErD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC","sourcesContent":["// Icon: every Lucide icon by name, shipped with the package; apps never import lucide-react.\nexport { Icon } from \"./icon\";\nexport type { IconProps } from \"./icon\";\nexport type { IconColor, IconName, IconSize } from \"./icon-names\";\nexport { Card, CardBody, CardFooter, CardHeader, CardMedia } from \"./card\";\nexport type { CardHeaderProps, CardHeadingLevel, CardMediaProps, CardProps, CardVariant } from \"./card\";\nexport { Avatar, AvatarGroup } from \"./avatar\";\nexport type { AvatarGroupProps, AvatarProps, AvatarShape, AvatarSize } from \"./avatar\";\nexport { Badge, BadgeAnchor } from \"./badge\";\nexport type { BadgeCountProps, BadgeCountTone, BadgeProps, BadgeStatusProps, BadgeTone, BadgeVariant } from \"./badge\";\nexport { Separator } from \"./separator\";\nexport type { SeparatorProps } from \"./separator\";\nexport { Kbd } from \"./kbd\";\nexport type { KbdProps } from \"./kbd\";\nexport { Heading, Prose, Text } from \"./typography\";\nexport type { HeadingLevel, HeadingProps, HeadingSize, TextProps, TextSize, TextTone } from \"./typography\";\nexport { Stat, StatGroup } from \"./stat\";\nexport type { StatDelta, StatProps } from \"./stat\";\nexport { DescriptionList } from \"./description-list\";\nexport type { DescriptionListItem, DescriptionListProps } from \"./description-list\";\nexport { Timeline } from \"./timeline\";\nexport type { TimelineItem, TimelineProps, TimelineTone } from \"./timeline\";\nexport { Carousel, CarouselSlide } from \"./carousel\";\nexport type { CarouselItem, CarouselProps, CarouselSlideProps } from \"./carousel\";\nexport { ImageViewer, wrapPhotoIndex } from \"./image-viewer\";\nexport type { ImageViewerImage, ImageViewerImageProps, ImageViewerProps } from \"./image-viewer\";\nexport { VisuallyHidden } from \"./visually-hidden\";\nexport type { VisuallyHiddenProps } from \"./visually-hidden\";\nexport { Image } from \"./image\";\nexport type { ImageProps } from \"./image\";\n"]}
@@ -0,0 +1,19 @@
1
+ import * as React from "react";
2
+ export type IsoChipProps = {
3
+ /** The two-letter ISO 3166 code ("DE", "US") or another short region code, shown as given. */
4
+ code: string;
5
+ };
6
+ /**
7
+ * The chip under a DS part's own `data-slot`: PhoneField keeps "phone-field-iso".
8
+ * Package-internal (not in the display index); apps use `IsoChip`.
9
+ */
10
+ export declare function IsoChipMark({ code, slot }: IsoChipProps & {
11
+ slot: string;
12
+ }): React.JSX.Element;
13
+ /**
14
+ * A country or region as its two-letter code in a small neutral chip, never an emoji flag nor a colour alone:
15
+ * the mark PhoneField shows before each country. Decorative beside the country's name, as in
16
+ * a ComboBox or MultiSelect item's `icon` (which hides it from assistive technology); shown alone, give it a
17
+ * name around it (a `role="img"` wrapper with the country's `aria-label`, a tooltip trigger's label).
18
+ */
19
+ export declare function IsoChip({ code }: IsoChipProps): React.JSX.Element;
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ /** 16px high, at least 24px wide, on `ds-radius-xsmall`: a country or language code beside its name (PhoneField's country button and list). */
4
+ const ISO_CHIP = "inline-grid h-4 min-w-6 shrink-0 place-items-center rounded-ds-xsmall bg-ds-background-neutral px-ds-050 text-[11px] leading-4 font-medium text-ds-text-subtle";
5
+ /**
6
+ * The chip under a DS part's own `data-slot`: PhoneField keeps "phone-field-iso".
7
+ * Package-internal (not in the display index); apps use `IsoChip`.
8
+ */
9
+ export function IsoChipMark({ code, slot }) {
10
+ return (_jsx("span", { "data-slot": slot, className: ISO_CHIP, children: code }));
11
+ }
12
+ /**
13
+ * A country or region as its two-letter code in a small neutral chip, never an emoji flag nor a colour alone:
14
+ * the mark PhoneField shows before each country. Decorative beside the country's name, as in
15
+ * a ComboBox or MultiSelect item's `icon` (which hides it from assistive technology); shown alone, give it a
16
+ * name around it (a `role="img"` wrapper with the country's `aria-label`, a tooltip trigger's label).
17
+ */
18
+ export function IsoChip({ code }) {
19
+ return _jsx(IsoChipMark, { code: code, slot: "iso-chip" });
20
+ }
21
+ //# sourceMappingURL=iso-chip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iso-chip.js","sourceRoot":"","sources":["../../src/display/iso-chip.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,+IAA+I;AAC/I,MAAM,QAAQ,GACZ,gKAAgK,CAAC;AAOnK;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,EAAE,IAAI,EAAE,IAAI,EAAmC;IACzE,OAAO,CACL,4BAAiB,IAAI,EAAE,SAAS,EAAE,QAAQ,YACvC,IAAI,GACA,CACR,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,EAAE,IAAI,EAAgB;IAC5C,OAAO,KAAC,WAAW,IAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC,UAAU,GAAG,CAAC;AACrD,CAAC","sourcesContent":["import * as React from \"react\";\n\n/** 16px high, at least 24px wide, on `ds-radius-xsmall`: a country or language code beside its name (PhoneField's country button and list). */\nconst ISO_CHIP =\n \"inline-grid h-4 min-w-6 shrink-0 place-items-center rounded-ds-xsmall bg-ds-background-neutral px-ds-050 text-[11px] leading-4 font-medium text-ds-text-subtle\";\n\nexport type IsoChipProps = {\n /** The two-letter ISO 3166 code (\"DE\", \"US\") or another short region code, shown as given. */\n code: string;\n};\n\n/**\n * The chip under a DS part's own `data-slot`: PhoneField keeps \"phone-field-iso\".\n * Package-internal (not in the display index); apps use `IsoChip`.\n */\nexport function IsoChipMark({ code, slot }: IsoChipProps & { slot: string }) {\n return (\n <span data-slot={slot} className={ISO_CHIP}>\n {code}\n </span>\n );\n}\n\n/**\n * A country or region as its two-letter code in a small neutral chip, never an emoji flag nor a colour alone:\n * the mark PhoneField shows before each country. Decorative beside the country's name, as in\n * a ComboBox or MultiSelect item's `icon` (which hides it from assistive technology); shown alone, give it a\n * name around it (a `role=\"img\"` wrapper with the country's `aria-label`, a tooltip trigger's label).\n */\nexport function IsoChip({ code }: IsoChipProps) {\n return <IsoChipMark code={code} slot=\"iso-chip\" />;\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import * as React from "react";
2
+ export type KbdProps = {
3
+ /** One key per Kbd; a shortcut is several Kbd separated by a space. Left out with `isModifier`. */
4
+ children?: React.ReactNode;
5
+ /** The platform's shortcut modifier: ⌘ on Apple platforms, Ctrl elsewhere (Ctrl on the server, settled after mount). */
6
+ isModifier?: boolean;
7
+ /** What a screen reader says instead of a glyph it may skip ("Command" for ⌘); the glyph is then hidden. */
8
+ label?: string;
9
+ };
10
+ /** A key or shortcut as a small keycap in help text, menus and tooltips. */
11
+ export declare function Kbd({ children, label, isModifier }: KbdProps): React.JSX.Element;
@@ -0,0 +1,33 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { cn } from "../utils.js";
5
+ // 20px including a 1px ds-border, whose bottom edge is ds-border-bold.
6
+ const KEYCAP = "box-border inline-grid h-5 min-w-5 place-items-center rounded-ds-xsmall border border-ds-border border-b-ds-border-bold " +
7
+ "bg-ds-surface-raised px-[5px] font-ds-mono text-[11px] leading-none text-ds-text-subtle";
8
+ /** A key or shortcut as a small keycap in help text, menus and tooltips. */
9
+ export function Kbd({ children, label, isModifier }) {
10
+ const apple = useApple(isModifier === true);
11
+ // Key names as printed on the keys; Apple labels ⌘ "command" in every language.
12
+ if (isModifier)
13
+ return apple ? _jsx(Kbd, { label: "Command", children: "\u2318" }) : _jsx(Kbd, { children: "Ctrl" });
14
+ return (_jsx("kbd", { "data-slot": "kbd", className: KEYCAP, children: label ? (
15
+ // aria-label is not allowed on <kbd>, so the spoken name is text.
16
+ _jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": true, children: children }), _jsx("span", { className: "sr-only", children: label })] })) : (children) }));
17
+ }
18
+ function isApple() {
19
+ if (typeof navigator === "undefined")
20
+ return false;
21
+ const platform = navigator.userAgentData?.platform ?? navigator.platform ?? "";
22
+ return /mac|iphone|ipad|ipod/i.test(platform);
23
+ }
24
+ /** Apple or not, settled after mount so the server and the first client render agree (both say Ctrl). */
25
+ function useApple(enabled) {
26
+ const [apple, setApple] = React.useState(false);
27
+ React.useEffect(() => {
28
+ if (enabled)
29
+ setApple(isApple());
30
+ }, [enabled]);
31
+ return apple;
32
+ }
33
+ //# sourceMappingURL=kbd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kbd.js","sourceRoot":"","sources":["../../src/display/kbd.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAE9B,uEAAuE;AACvE,MAAM,MAAM,GACV,0HAA0H;IAC1H,yFAAyF,CAAC;AAW5F,4EAA4E;AAC5E,MAAM,UAAU,GAAG,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAY;IAC3D,MAAM,KAAK,GAAG,QAAQ,CAAC,UAAU,KAAK,IAAI,CAAC,CAAC;IAC5C,gFAAgF;IAChF,IAAI,UAAU;QAAE,OAAO,KAAK,CAAC,CAAC,CAAC,KAAC,GAAG,IAAC,KAAK,EAAC,SAAS,uBAAQ,CAAC,CAAC,CAAC,KAAC,GAAG,uBAAW,CAAC;IAC9E,OAAO,CACL,2BAAe,KAAK,EAAC,SAAS,EAAE,MAAM,YACnC,KAAK,CAAC,CAAC,CAAC;QACP,kEAAkE;QAClE,8BACE,8CAAmB,QAAQ,GAAQ,EACnC,eAAM,SAAS,EAAC,SAAS,YAAE,KAAK,GAAQ,IACvC,CACJ,CAAC,CAAC,CAAC,CACF,QAAQ,CACT,GACG,CACP,CAAC;AACJ,CAAC;AAED,SAAS,OAAO;IACd,IAAI,OAAO,SAAS,KAAK,WAAW;QAAE,OAAO,KAAK,CAAC;IACnD,MAAM,QAAQ,GAAI,SAAmE,CAAC,aAAa,EAAE,QAAQ,IAAI,SAAS,CAAC,QAAQ,IAAI,EAAE,CAAC;IAC1I,OAAO,uBAAuB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAChD,CAAC;AAED,yGAAyG;AACzG,SAAS,QAAQ,CAAC,OAAgB;IAChC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChD,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,OAAO;YAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACnC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACd,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nimport { cn } from \"../utils\";\n\n// 20px including a 1px ds-border, whose bottom edge is ds-border-bold.\nconst KEYCAP =\n \"box-border inline-grid h-5 min-w-5 place-items-center rounded-ds-xsmall border border-ds-border border-b-ds-border-bold \" +\n \"bg-ds-surface-raised px-[5px] font-ds-mono text-[11px] leading-none text-ds-text-subtle\";\n\nexport type KbdProps = {\n /** One key per Kbd; a shortcut is several Kbd separated by a space. Left out with `isModifier`. */\n children?: React.ReactNode;\n /** The platform's shortcut modifier: ⌘ on Apple platforms, Ctrl elsewhere (Ctrl on the server, settled after mount). */\n isModifier?: boolean;\n /** What a screen reader says instead of a glyph it may skip (\"Command\" for ⌘); the glyph is then hidden. */\n label?: string;\n};\n\n/** A key or shortcut as a small keycap in help text, menus and tooltips. */\nexport function Kbd({ children, label, isModifier }: KbdProps) {\n const apple = useApple(isModifier === true);\n // Key names as printed on the keys; Apple labels ⌘ \"command\" in every language.\n if (isModifier) return apple ? <Kbd label=\"Command\">⌘</Kbd> : <Kbd>Ctrl</Kbd>;\n return (\n <kbd data-slot=\"kbd\" className={KEYCAP}>\n {label ? (\n // aria-label is not allowed on <kbd>, so the spoken name is text.\n <>\n <span aria-hidden>{children}</span>\n <span className=\"sr-only\">{label}</span>\n </>\n ) : (\n children\n )}\n </kbd>\n );\n}\n\nfunction isApple() {\n if (typeof navigator === \"undefined\") return false;\n const platform = (navigator as Navigator & { userAgentData?: { platform?: string } }).userAgentData?.platform ?? navigator.platform ?? \"\";\n return /mac|iphone|ipad|ipod/i.test(platform);\n}\n\n/** Apple or not, settled after mount so the server and the first client render agree (both say Ctrl). */\nfunction useApple(enabled: boolean) {\n const [apple, setApple] = React.useState(false);\n React.useEffect(() => {\n if (enabled) setApple(isApple());\n }, [enabled]);\n return apple;\n}\n"]}
@@ -0,0 +1,30 @@
1
+ import * as React from "react";
2
+ export type LozengeTone = "neutral" | "information" | "brand" | "success" | "warning" | "danger";
3
+ /** `subtle` and `bold` are pills; `plain` is a dot and the word, for a live system state (online, syncing). */
4
+ export type LozengeAppearance = "subtle" | "bold" | "plain";
5
+ type Base = {
6
+ /**
7
+ * One meaning per tone: information (Approved, In progress) · brand (Featured) · success
8
+ * (Completed, Available, Paid) · warning (Payment pending, Under review) · danger (Canceled,
9
+ * Failed, Overdue) · neutral (Draft, Inactive).
10
+ */
11
+ tone?: LozengeTone;
12
+ /** `bold` for the one status on the screen that needs attention now; `plain` for a live system state. */
13
+ appearance?: LozengeAppearance;
14
+ /** A 6px dot inside a pill (subtle or bold), for live states. `plain` always has its dot. */
15
+ hasDot?: boolean;
16
+ /** `plain` only: a 3px halo for a state that is active right now (connected, syncing). */
17
+ isLive?: boolean;
18
+ };
19
+ export type LozengeProps = Base & ({
20
+ /** The status word, sentence case ("Payment pending"); the word carries the meaning, never the colour. */
21
+ children: React.ReactNode;
22
+ "aria-label"?: never;
23
+ } | {
24
+ children?: never;
25
+ /** `plain` only, where a visible word is impossible (a dense table cell with its own column header). */
26
+ "aria-label": string;
27
+ });
28
+ /** The status of a record, or a live state, in one or two words. Not interactive; never inside a button. */
29
+ export declare function Lozenge({ children, tone, appearance, hasDot, isLive, "aria-label": ariaLabel }: LozengeProps): React.JSX.Element;
30
+ export {};
@@ -0,0 +1,55 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import { cn } from "../utils.js";
4
+ const SUBTLE = {
5
+ neutral: "bg-ds-background-neutral text-ds-text-subtle",
6
+ information: "bg-ds-background-information text-ds-text-information",
7
+ brand: "bg-ds-background-brand-subtle text-ds-text-brand",
8
+ success: "bg-ds-background-success text-ds-text-success",
9
+ warning: "bg-ds-background-warning text-ds-text-warning",
10
+ danger: "bg-ds-background-danger text-ds-text-danger",
11
+ };
12
+ const BOLD = {
13
+ neutral: "bg-ds-background-neutral-bold text-ds-text-inverse",
14
+ information: "bg-ds-background-information-bold text-ds-text-on-bold",
15
+ brand: "bg-ds-background-brand-bold text-ds-text-on-brand",
16
+ success: "bg-ds-background-success-bold text-ds-text-on-bold",
17
+ warning: "bg-ds-background-warning-bold text-ds-text-on-warning",
18
+ danger: "bg-ds-background-danger-bold text-ds-text-on-danger",
19
+ };
20
+ // `plain`: the 8px dot in the tone's icon color; the word stays in the body color.
21
+ const DOT = {
22
+ neutral: "bg-ds-icon-subtle",
23
+ information: "bg-ds-icon-information",
24
+ brand: "bg-ds-icon-brand",
25
+ success: "bg-ds-icon-success",
26
+ warning: "bg-ds-icon-warning",
27
+ danger: "bg-ds-icon-danger",
28
+ };
29
+ // The live halo sits in the tone's status background.
30
+ const HALO = {
31
+ neutral: "ring-ds-background-neutral",
32
+ information: "ring-ds-background-information",
33
+ brand: "ring-ds-background-brand-subtle",
34
+ success: "ring-ds-background-success",
35
+ warning: "ring-ds-background-warning",
36
+ danger: "ring-ds-background-danger",
37
+ };
38
+ /** The status of a record, or a live state, in one or two words. Not interactive; never inside a button. */
39
+ export function Lozenge({ children, tone = "neutral", appearance = "subtle", hasDot, isLive, "aria-label": ariaLabel }) {
40
+ if (appearance === "plain") {
41
+ // null, false and "" are no word either.
42
+ const hasWord = children != null && children !== false && children !== "";
43
+ const dot = (_jsx("span", { "data-slot": "lozenge-dot", "aria-hidden": true, className: cn("size-ds-100 shrink-0 rounded-ds-full", DOT[tone], isLive && cn("ring-3", HALO[tone])) }));
44
+ if (!hasWord) {
45
+ return (
46
+ // A named image with a label; without one it only decorates, never an unnamed image.
47
+ _jsx("span", { role: ariaLabel ? "img" : undefined, "aria-label": ariaLabel, "aria-hidden": ariaLabel ? undefined : true, "data-slot": "lozenge", "data-tone": tone, "data-appearance": "plain", "data-live": isLive || undefined, className: "inline-flex items-center", children: dot }));
48
+ }
49
+ return (
50
+ // The halo is a shadow and takes no space, so a live dot gets the wider gap to keep the word clear of it.
51
+ _jsxs("span", { "data-slot": "lozenge", "data-tone": tone, "data-appearance": "plain", "data-live": isLive || undefined, className: cn("inline-flex items-center text-body text-ds-text", isLive ? "gap-ds-100" : "gap-ds-075"), children: [dot, _jsx("span", { "data-slot": "lozenge-label", children: children })] }));
52
+ }
53
+ return (_jsxs("span", { "data-slot": "lozenge", "data-tone": tone, "data-appearance": appearance, className: cn("inline-flex h-5 shrink-0 items-center gap-ds-050 rounded-ds-xsmall px-ds-075 text-body-small font-medium whitespace-nowrap", appearance === "bold" ? BOLD[tone] : SUBTLE[tone]), children: [hasDot && _jsx("span", { "data-slot": "lozenge-dot", "aria-hidden": true, className: "size-1.5 rounded-ds-full bg-current" }), children] }));
54
+ }
55
+ //# sourceMappingURL=lozenge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lozenge.js","sourceRoot":"","sources":["../../src/display/lozenge.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAM9B,MAAM,MAAM,GAAgC;IAC1C,OAAO,EAAE,8CAA8C;IACvD,WAAW,EAAE,uDAAuD;IACpE,KAAK,EAAE,kDAAkD;IACzD,OAAO,EAAE,+CAA+C;IACxD,OAAO,EAAE,+CAA+C;IACxD,MAAM,EAAE,6CAA6C;CACtD,CAAC;AACF,MAAM,IAAI,GAAgC;IACxC,OAAO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AAK,CAAC,CAAC,CAAC,SAAS,gBACvB,SAAS,iBACR,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,eAC/B,SAAS,eACR,IAAI,qBACC,OAAO,eACZ,MAAM,IAAI,SAAS,EAC9B,SAAS,EAAC,0BAA0B,YAEnC,GAAG,GACC,CACR,CAAC;QACJ,CAAC;QACD,OAAO;QACL,0GAA0G;QAC1G,6BACY,SAAS,eACR,IAAI,qBACC,OAAO,eACZ,MAAM,IAAI,SAAS,EAC9B,SAAS,EAAE,EAAE,CAAC,iDAAiD,EAAE,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,aAErG,GAAG,EACJ,4BAAgB,eAAe,YAAE,QAAQ,GAAQ,IAC5C,CACR,CAAC;IACJ,CAAC;IACD,OAAO,CACL,6BACY,SAAS,eACR,IAAI,qBACE,UAAU,EAC3B,SAAS,EAAE,EAAE,CACX,4HAA4H,EAC5H,UAAU,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAClD,aAEA,MAAM,IAAI,4BAAgB,aAAa,uBAAa,SAAS,EAAC,qCAAqC,GAAG,EACtG,QAAQ,IACJ,CACR,CAAC;AACJ,CAAC","sourcesContent":["import * as React from \"react\";\n\nimport { cn } from \"../utils\";\n\nexport type LozengeTone = \"neutral\" | \"information\" | \"brand\" | \"success\" | \"warning\" | \"danger\";\n/** `subtle` and `bold` are pills; `plain` is a dot and the word, for a live system state (online, syncing). */\nexport type LozengeAppearance = \"subtle\" | \"bold\" | \"plain\";\n\nconst SUBTLE: Record<LozengeTone, string> = {\n neutral: \"bg-ds-background-neutral text-ds-text-subtle\",\n information: \"bg-ds-background-information text-ds-text-information\",\n brand: \"bg-ds-background-brand-subtle text-ds-text-brand\",\n success: \"bg-ds-background-success text-ds-text-success\",\n warning: \"bg-ds-background-warning text-ds-text-warning\",\n danger: \"bg-ds-background-danger text-ds-text-danger\",\n};\nconst BOLD: Record<LozengeTone, string> = {\n neutral: \"bg-ds-background-neutral-bold text-ds-text-inverse\",\n information: \"bg-ds-background-information-bold text-ds-text-on-bold\",\n brand: \"bg-ds-background-brand-bold text-ds-text-on-brand\",\n success: \"bg-ds-background-success-bold text-ds-text-on-bold\",\n warning: \"bg-ds-background-warning-bold text-ds-text-on-warning\",\n danger: \"bg-ds-background-danger-bold text-ds-text-on-danger\",\n};\n// `plain`: the 8px dot in the tone's icon color; the word stays in the body color.\nconst DOT: Record<LozengeTone, string> = {\n neutral: \"bg-ds-icon-subtle\",\n information: \"bg-ds-icon-information\",\n brand: \"bg-ds-icon-brand\",\n success: \"bg-ds-icon-success\",\n warning: \"bg-ds-icon-warning\",\n danger: \"bg-ds-icon-danger\",\n};\n// The live halo sits in the tone's status background.\nconst HALO: Record<LozengeTone, string> = {\n neutral: \"ring-ds-background-neutral\",\n information: \"ring-ds-background-information\",\n brand: \"ring-ds-background-brand-subtle\",\n success: \"ring-ds-background-success\",\n warning: \"ring-ds-background-warning\",\n danger: \"ring-ds-background-danger\",\n};\n\ntype Base = {\n /**\n * One meaning per tone: information (Approved, In progress) · brand (Featured) · success\n * (Completed, Available, Paid) · warning (Payment pending, Under review) · danger (Canceled,\n * Failed, Overdue) · neutral (Draft, Inactive).\n */\n tone?: LozengeTone;\n /** `bold` for the one status on the screen that needs attention now; `plain` for a live system state. */\n appearance?: LozengeAppearance;\n /** A 6px dot inside a pill (subtle or bold), for live states. `plain` always has its dot. */\n hasDot?: boolean;\n /** `plain` only: a 3px halo for a state that is active right now (connected, syncing). */\n isLive?: boolean;\n};\n\nexport type LozengeProps = Base &\n (\n | {\n /** The status word, sentence case (\"Payment pending\"); the word carries the meaning, never the colour. */\n children: React.ReactNode;\n \"aria-label\"?: never;\n }\n | {\n children?: never;\n /** `plain` only, where a visible word is impossible (a dense table cell with its own column header). */\n \"aria-label\": string;\n }\n );\n\n/** The status of a record, or a live state, in one or two words. Not interactive; never inside a button. */\nexport function Lozenge({ children, tone = \"neutral\", appearance = \"subtle\", hasDot, isLive, \"aria-label\": ariaLabel }: LozengeProps) {\n if (appearance === \"plain\") {\n // null, false and \"\" are no word either.\n const hasWord = children != null && children !== false && children !== \"\";\n const dot = (\n <span data-slot=\"lozenge-dot\" aria-hidden className={cn(\"size-ds-100 shrink-0 rounded-ds-full\", DOT[tone], isLive && cn(\"ring-3\", HALO[tone]))} />\n );\n if (!hasWord) {\n return (\n // A named image with a label; without one it only decorates, never an unnamed image.\n <span\n role={ariaLabel ? \"img\" : undefined}\n aria-label={ariaLabel}\n aria-hidden={ariaLabel ? undefined : true}\n data-slot=\"lozenge\"\n data-tone={tone}\n data-appearance=\"plain\"\n data-live={isLive || undefined}\n className=\"inline-flex items-center\"\n >\n {dot}\n </span>\n );\n }\n return (\n // The halo is a shadow and takes no space, so a live dot gets the wider gap to keep the word clear of it.\n <span\n data-slot=\"lozenge\"\n data-tone={tone}\n data-appearance=\"plain\"\n data-live={isLive || undefined}\n className={cn(\"inline-flex items-center text-body text-ds-text\", isLive ? \"gap-ds-100\" : \"gap-ds-075\")}\n >\n {dot}\n <span data-slot=\"lozenge-label\">{children}</span>\n </span>\n );\n }\n return (\n <span\n data-slot=\"lozenge\"\n data-tone={tone}\n data-appearance={appearance}\n className={cn(\n \"inline-flex h-5 shrink-0 items-center gap-ds-050 rounded-ds-xsmall px-ds-075 text-body-small font-medium whitespace-nowrap\",\n appearance === \"bold\" ? BOLD[tone] : SUBTLE[tone],\n )}\n >\n {hasDot && <span data-slot=\"lozenge-dot\" aria-hidden className=\"size-1.5 rounded-ds-full bg-current\" />}\n {children}\n </span>\n );\n}\n"]}
@@ -0,0 +1,29 @@
1
+ import * as React from "react";
2
+ export type ScrollAreaProps = {
3
+ children: React.ReactNode;
4
+ /** Names the region; screen readers announce it when focus enters. */
5
+ "aria-label": string;
6
+ /** The region's height limit ("320px", 320, "60vh"); for horizontal areas, set the width on the parent. */
7
+ maxHeight?: number | string;
8
+ /**
9
+ * Fills the parent's height and scrolls inside it, for a pane in a flex column or a grid
10
+ * row that is given its height: a conversation's messages between its header and the reply box, a list
11
+ * beside it. The parent must give the area a definite height (`min-h-0` on a flex or grid child).
12
+ * Leave `maxHeight` out when filling.
13
+ */
14
+ fill?: boolean;
15
+ orientation?: "vertical" | "horizontal" | "both";
16
+ };
17
+ /**
18
+ * A fixed-size region with its own native scroll (never hijacked) and the
19
+ * scrollbar contract (thin, a ds-border-bold thumb), plus an overflow
20
+ * shadow on each edge where content continues. When it holds nothing
21
+ * focusable it becomes a focusable region itself, so keyboard users can
22
+ * scroll it with the arrow keys.
23
+ *
24
+ * Known deviation: the design's 6px thumb is drawn by the platform's thin
25
+ * scrollbar (about 8–11px); standard CSS cannot size it further without
26
+ * replacing native scrolling. With `orientation="both"` the edge shadows
27
+ * follow the vertical axis.
28
+ */
29
+ export declare function ScrollArea({ children, "aria-label": ariaLabel, maxHeight, fill, orientation }: ScrollAreaProps): React.JSX.Element;