@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
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Senvenli
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,33 @@
1
- # Temporary Holding Version
1
+ # @senvenli/react
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Web components built on React Aria Components and Tailwind v4, themed by [`@senvenli/tokens`](../tokens).
4
+
5
+ Status: scaffold. Components are being extracted family by family from an existing production library: display, action, layout, feedback, form, selection, overlay, navigation, date, color, collection and charts.
6
+
7
+ ## Setup
8
+
9
+ ```css
10
+ @import "tailwindcss";
11
+ @import "./theme.css"; /* from `npx senvenli-ui theme <code> --tailwind` or the theme builder */
12
+ @import "@senvenli/react/base.css";
13
+ ```
14
+
15
+ ```tsx
16
+ import { DesignSystemProvider } from "@senvenli/react";
17
+
18
+ <DesignSystemProvider locale="en" navigate={router.push}>
19
+ <App />
20
+ </DesignSystemProvider>;
21
+ ```
22
+
23
+ ## Languages
24
+
25
+ Component strings ship in English. Add another language once at startup:
26
+
27
+ ```ts
28
+ import { registerDsStrings } from "@senvenli/react";
29
+
30
+ registerDsStrings("tr", { close: "Kapat", optional: "(isteğe bağlı)" });
31
+ ```
32
+
33
+ Anything not registered falls back to English. Right-to-left layout follows the locale.
@@ -0,0 +1,26 @@
1
+ import * as React from "react";
2
+ export type ButtonGroupProps = Omit<React.HTMLAttributes<HTMLDivElement>, "className" | "style" | "role"> & {
3
+ /** Names the group for screen readers ("View", "Export"). */
4
+ "aria-label": string;
5
+ /**
6
+ * `split`: a primary main action with an icon button that opens a menu of
7
+ * alternatives; the seam uses the pressed brand fill instead of `ds-border`.
8
+ */
9
+ variant?: "default" | "split";
10
+ children: React.ReactNode;
11
+ };
12
+ /**
13
+ * Joins two to four related Buttons into one unit: they touch, inner corners
14
+ * are square, outer corners keep `ds-radius-medium`. Seams and corners use
15
+ * logical sides, so the group mirrors in RTL.
16
+ */
17
+ export declare const ButtonGroup: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLDivElement>, "style" | "className" | "role"> & {
18
+ /** Names the group for screen readers ("View", "Export"). */
19
+ "aria-label": string;
20
+ /**
21
+ * `split`: a primary main action with an icon button that opens a menu of
22
+ * alternatives; the seam uses the pressed brand fill instead of `ds-border`.
23
+ */
24
+ variant?: "default" | "split";
25
+ children: React.ReactNode;
26
+ } & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import { cn } from "../utils.js";
4
+ /**
5
+ * Joins two to four related Buttons into one unit: they touch, inner corners
6
+ * are square, outer corners keep `ds-radius-medium`. Seams and corners use
7
+ * logical sides, so the group mirrors in RTL.
8
+ */
9
+ export const ButtonGroup = React.forwardRef(function ButtonGroup({ variant = "default", children, ...rest }, ref) {
10
+ return (_jsx("div", { ...rest, ref: ref, role: "group", "data-slot": "button-group", "data-variant": variant, className: cn("inline-flex isolate", "[&>*:not(:first-child)]:rounded-s-none [&>*:not(:last-child)]:rounded-e-none", "[&>*+*]:border-s [&>[data-focus-visible]]:z-10", variant === "split" ? "[&>*+*]:border-ds-background-brand-bold-pressed" : "[&>*+*]:border-ds-border"), children: children }));
11
+ });
12
+ //# sourceMappingURL=button-group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button-group.js","sourceRoot":"","sources":["../../src/action/button-group.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAa9B;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAAC,UAAU,CAAmC,SAAS,WAAW,CAChG,EAAE,OAAO,GAAG,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAC1C,GAAG;IAEH,OAAO,CACL,iBACM,IAAI,EACR,GAAG,EAAE,GAAG,EACR,IAAI,EAAC,OAAO,eACF,cAAc,kBACV,OAAO,EACrB,SAAS,EAAE,EAAE,CACX,qBAAqB,EACrB,8EAA8E,EAC9E,gDAAgD,EAChD,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,iDAAiD,CAAC,CAAC,CAAC,0BAA0B,CACrG,YAEA,QAAQ,GACL,CACP,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import * as React from \"react\";\n\nimport { cn } from \"../utils\";\n\nexport type ButtonGroupProps = Omit<React.HTMLAttributes<HTMLDivElement>, \"className\" | \"style\" | \"role\"> & {\n /** Names the group for screen readers (\"View\", \"Export\"). */\n \"aria-label\": string;\n /**\n * `split`: a primary main action with an icon button that opens a menu of\n * alternatives; the seam uses the pressed brand fill instead of `ds-border`.\n */\n variant?: \"default\" | \"split\";\n children: React.ReactNode;\n};\n\n/**\n * Joins two to four related Buttons into one unit: they touch, inner corners\n * are square, outer corners keep `ds-radius-medium`. Seams and corners use\n * logical sides, so the group mirrors in RTL.\n */\nexport const ButtonGroup = React.forwardRef<HTMLDivElement, ButtonGroupProps>(function ButtonGroup(\n { variant = \"default\", children, ...rest },\n ref,\n) {\n return (\n <div\n {...rest}\n ref={ref}\n role=\"group\"\n data-slot=\"button-group\"\n data-variant={variant}\n className={cn(\n \"inline-flex isolate\",\n \"[&>*:not(:first-child)]:rounded-s-none [&>*:not(:last-child)]:rounded-e-none\",\n \"[&>*+*]:border-s [&>[data-focus-visible]]:z-10\",\n variant === \"split\" ? \"[&>*+*]:border-ds-background-brand-bold-pressed\" : \"[&>*+*]:border-ds-border\",\n )}\n >\n {children}\n </div>\n );\n});\n"]}
@@ -0,0 +1,42 @@
1
+ import * as React from "react";
2
+ import { type ButtonProps as AriaButtonProps } from "react-aria-components";
3
+ import { type IconName } from "../display/icon.js";
4
+ import { type ComponentRadius } from "../defaults.js";
5
+ import { type ButtonSize, type ButtonTone, type ButtonVariant } from "./styles.js";
6
+ import { type LinkButtonProps } from "./link-button.js";
7
+ type BaseProps = Omit<AriaButtonProps, "className" | "style" | "children"> & {
8
+ /** `primary` is the one main action of a view; `subtle` for toolbars and rows; `link` for a quiet text action. */
9
+ variant?: ButtonVariant;
10
+ /** `danger` for a destructive action (delete, discard); it keeps the variant's shape. */
11
+ tone?: ButtonTone;
12
+ /** As wide as its container (a form's submit on a phone, a stacked set of actions). */
13
+ fullWidth?: boolean;
14
+ /** Corner radius: `none`, `small`, `medium` (the design), `large` or `full` (a pill). The provider's default otherwise. */
15
+ radius?: ComponentRadius;
16
+ size?: ButtonSize;
17
+ /** Lucide icon name shown before the label ("plus"). */
18
+ iconBefore?: IconName;
19
+ /** Lucide icon name shown after the label. */
20
+ iconAfter?: IconName;
21
+ };
22
+ /** The press form's props: an action in place (no `href`). */
23
+ export type ButtonActionProps = BaseProps & {
24
+ href?: never;
25
+ } & ({
26
+ children: React.ReactNode;
27
+ iconOnly?: false;
28
+ } | {
29
+ /** A square button that shows only `iconBefore`; it needs an `aria-label`. */
30
+ iconOnly: true;
31
+ iconBefore: IconName;
32
+ "aria-label": string;
33
+ children?: never;
34
+ });
35
+ export type ButtonProps = ButtonActionProps | LinkButtonProps;
36
+ /**
37
+ * A button: an action in place, or with `href` a link that looks like one (a page in the app, a download, another
38
+ * site), as MUI and Ant Design do. `iconOnly` makes a square icon button named by its `aria-label`. `type="button"`
39
+ * by default, so it never submits a form by accident; `isPending` keeps the label in place under a spinner.
40
+ */
41
+ export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
42
+ export {};
@@ -0,0 +1,58 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { Button as AriaButton } from "react-aria-components";
5
+ import { IconGlyph } from "../display/icon.js";
6
+ import { cn } from "../utils.js";
7
+ import { radiusClass, useComponentDefaults } from "../defaults.js";
8
+ import { BUTTON_BASE, BUTTON_SIZE, buttonVariantClasses, ICON, ICON_ONLY_SIZE, LINK_BUTTON_PADDING, hasTouchTarget, } from "./styles.js";
9
+ import { TouchTarget } from "./touch-target.js";
10
+ import { LinkButton } from "./link-button.js";
11
+ function Spinner() {
12
+ return (_jsx("span", { "aria-hidden": "true", "data-slot": "button-spinner", className: "absolute inset-0 m-auto size-ds-icon animate-spin rounded-ds-full border-2 border-current border-e-transparent motion-reduce:animate-none" }));
13
+ }
14
+ /**
15
+ * Triggers an action in place. `type="button"`
16
+ * by default so it never submits a form by accident. While `isPending` the
17
+ * label stays in the layout and in the accessible name (only its opacity
18
+ * drops, so the width never jumps), a spinner covers it and
19
+ * `aria-busy` is set; React Aria keeps focus and ignores presses. Compact and small icon-only buttons
20
+ * are 44px to a coarse pointer, with nothing drawn (`TouchTarget`).
21
+ */
22
+ const PressButton = React.forwardRef(function PressButton({ variant = "default", tone = "neutral", fullWidth = false, size: sizeProp, radius: radiusProp, iconBefore, iconAfter, iconOnly, children, type = "button", isPending, ...rest }, forwardedRef) {
23
+ const defaults = useComponentDefaults();
24
+ const size = sizeProp ?? defaults.size ?? "medium";
25
+ const radius = radiusProp ?? defaults.radius;
26
+ // React Aria announces the pending state but does not forward `aria-busy`;
27
+ // the design asks for it, so it is set on the element directly.
28
+ const local = React.useRef(null);
29
+ const ref = React.useCallback((node) => {
30
+ local.current = node;
31
+ if (typeof forwardedRef === "function")
32
+ forwardedRef(node);
33
+ else if (forwardedRef)
34
+ forwardedRef.current = node;
35
+ }, [forwardedRef]);
36
+ React.useLayoutEffect(() => {
37
+ const node = local.current;
38
+ if (!node)
39
+ return;
40
+ if (isPending)
41
+ node.setAttribute("aria-busy", "true");
42
+ else
43
+ node.removeAttribute("aria-busy");
44
+ }, [isPending]);
45
+ return (_jsxs(AriaButton, { ...rest, ref: ref, type: type, isPending: isPending, "data-slot": rest["data-slot"] ?? "button", "data-variant": variant, "data-tone": tone, "data-size": size, className: cn(BUTTON_BASE, fullWidth && "w-full", buttonVariantClasses(variant, tone), BUTTON_SIZE[size], variant === "link" && LINK_BUTTON_PADDING, iconOnly && ICON_ONLY_SIZE[size], radiusClass(radius)), children: [_jsxs("span", { "data-slot": "button-content", className: cn("inline-flex items-center gap-ds-075", isPending && "opacity-0"), children: [iconBefore && _jsx(IconGlyph, { name: iconBefore, "data-slot": "button-icon", className: ICON }), !iconOnly && children, iconAfter && !iconOnly && _jsx(IconGlyph, { name: iconAfter, "data-slot": "button-icon", className: ICON })] }), isPending && _jsx(Spinner, {}), hasTouchTarget(size, iconOnly) && _jsx(TouchTarget, {})] }));
46
+ });
47
+ /**
48
+ * A button: an action in place, or with `href` a link that looks like one (a page in the app, a download, another
49
+ * site), as MUI and Ant Design do. `iconOnly` makes a square icon button named by its `aria-label`. `type="button"`
50
+ * by default, so it never submits a form by accident; `isPending` keeps the label in place under a spinner.
51
+ */
52
+ export const Button = React.forwardRef(function Button(props, ref) {
53
+ if (props.href !== undefined)
54
+ return _jsx(LinkButton, { ...props, ref: ref });
55
+ const { href: _href, ...rest } = props;
56
+ return _jsx(PressButton, { ...rest, ref: ref });
57
+ });
58
+ //# sourceMappingURL=button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/action/button.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,IAAI,UAAU,EAAuC,MAAM,uBAAuB,CAAC;AAElG,OAAO,EAAE,SAAS,EAAiB,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAwB,MAAM,aAAa,CAAC;AACtF,OAAO,EACL,WAAW,EAAE,WAAW,EAAE,oBAAoB,EAAE,IAAI,EAAE,cAAc,EAAE,mBAAmB,EAAE,cAAc,GAE1G,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAwB,MAAM,eAAe,CAAC;AA+BjE,SAAS,OAAO;IACd,OAAO,CACL,8BACc,MAAM,eACR,gBAAgB,EAC1B,SAAS,EAAC,2IAA2I,GACrJ,CACH,CAAC;AACJ,CAAC;AAED;;;;;;;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IAAI,EAAE,GAAG,EAAE,GAAmC,GAAI,CAAC;AAC7E,CAAC,CAAC,CAAC","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Button as AriaButton, type ButtonProps as AriaButtonProps } from \"react-aria-components\";\n\nimport { IconGlyph, type IconName } from \"../display/icon\";\nimport { cn } from \"../utils\";\nimport { radiusClass, useComponentDefaults, type ComponentRadius } from \"../defaults\";\nimport {\n BUTTON_BASE, BUTTON_SIZE, buttonVariantClasses, ICON, ICON_ONLY_SIZE, LINK_BUTTON_PADDING, hasTouchTarget,\n type ButtonSize, type ButtonTone, type ButtonVariant,\n} from \"./styles\";\nimport { TouchTarget } from \"./touch-target\";\nimport { LinkButton, type LinkButtonProps } from \"./link-button\";\n\ntype BaseProps = Omit<AriaButtonProps, \"className\" | \"style\" | \"children\"> & {\n /** `primary` is the one main action of a view; `subtle` for toolbars and rows; `link` for a quiet text action. */\n variant?: ButtonVariant;\n /** `danger` for a destructive action (delete, discard); it keeps the variant's shape. */\n tone?: ButtonTone;\n /** As wide as its container (a form's submit on a phone, a stacked set of actions). */\n fullWidth?: boolean;\n /** Corner radius: `none`, `small`, `medium` (the design), `large` or `full` (a pill). The provider's default otherwise. */\n radius?: ComponentRadius;\n size?: ButtonSize;\n /** Lucide icon name shown before the label (\"plus\"). */\n iconBefore?: IconName;\n /** Lucide icon name shown after the label. */\n iconAfter?: IconName;\n};\n\n/** The press form's props: an action in place (no `href`). */\nexport type ButtonActionProps = BaseProps & { href?: never } &\n (\n | { /** The label: the verb of what happens (\"Save\"). */ children: React.ReactNode; iconOnly?: false }\n | {\n /** A square button that shows only `iconBefore`; it needs an `aria-label`. */\n iconOnly: true;\n iconBefore: IconName;\n \"aria-label\": string;\n children?: never;\n }\n );\n\nfunction Spinner() {\n return (\n <span\n aria-hidden=\"true\"\n data-slot=\"button-spinner\"\n className=\"absolute inset-0 m-auto size-ds-icon animate-spin rounded-ds-full border-2 border-current border-e-transparent motion-reduce:animate-none\"\n />\n );\n}\n\n/**\n * Triggers an action in place. `type=\"button\"`\n * by default so it never submits a form by accident. While `isPending` the\n * label stays in the layout and in the accessible name (only its opacity\n * drops, so the width never jumps), a spinner covers it and\n * `aria-busy` is set; React Aria keeps focus and ignores presses. Compact and small icon-only buttons\n * are 44px to a coarse pointer, with nothing drawn (`TouchTarget`).\n */\nconst PressButton = React.forwardRef<HTMLButtonElement, Omit<ButtonActionProps, \"href\">>(function PressButton(\n { variant = \"default\", tone = \"neutral\", fullWidth = false, size: sizeProp, radius: radiusProp, iconBefore, iconAfter, iconOnly, children, type = \"button\", isPending, ...rest },\n forwardedRef,\n) {\n const defaults = useComponentDefaults();\n const size = sizeProp ?? defaults.size ?? \"medium\";\n const radius = radiusProp ?? defaults.radius;\n // React Aria announces the pending state but does not forward `aria-busy`;\n // the design asks for it, so it is set on the element directly.\n const local = React.useRef<HTMLButtonElement | null>(null);\n const ref = React.useCallback(\n (node: HTMLButtonElement | null) => {\n local.current = node;\n if (typeof forwardedRef === \"function\") forwardedRef(node);\n else if (forwardedRef) forwardedRef.current = node;\n },\n [forwardedRef],\n );\n React.useLayoutEffect(() => {\n const node = local.current;\n if (!node) return;\n if (isPending) node.setAttribute(\"aria-busy\", \"true\");\n else node.removeAttribute(\"aria-busy\");\n }, [isPending]);\n\n return (\n <AriaButton\n {...rest}\n ref={ref}\n type={type}\n isPending={isPending}\n data-slot={(rest as { \"data-slot\"?: string })[\"data-slot\"] ?? \"button\"}\n data-variant={variant}\n data-tone={tone}\n data-size={size}\n className={cn(\n BUTTON_BASE,\n fullWidth && \"w-full\",\n buttonVariantClasses(variant, tone),\n BUTTON_SIZE[size],\n variant === \"link\" && LINK_BUTTON_PADDING,\n iconOnly && ICON_ONLY_SIZE[size],\n radiusClass(radius),\n )}\n >\n <span\n data-slot=\"button-content\"\n className={cn(\"inline-flex items-center gap-ds-075\", isPending && \"opacity-0\")}\n >\n {iconBefore && <IconGlyph name={iconBefore} data-slot=\"button-icon\" className={ICON} />}\n {!iconOnly && children}\n {iconAfter && !iconOnly && <IconGlyph name={iconAfter} data-slot=\"button-icon\" className={ICON} />}\n </span>\n {isPending && <Spinner />}\n {hasTouchTarget(size, iconOnly) && <TouchTarget />}\n </AriaButton>\n );\n});\n\nexport type ButtonProps = ButtonActionProps | LinkButtonProps;\n\n/**\n * A button: an action in place, or with `href` a link that looks like one (a page in the app, a download, another\n * site), as MUI and Ant Design do. `iconOnly` makes a square icon button named by its `aria-label`. `type=\"button\"`\n * by default, so it never submits a form by accident; `isPending` keeps the label in place under a spinner.\n */\nexport const Button = React.forwardRef<HTMLButtonElement | HTMLAnchorElement, ButtonProps>(function Button(props, ref) {\n if (props.href !== undefined) return <LinkButton {...(props as LinkButtonProps)} ref={ref as React.Ref<HTMLAnchorElement>} />;\n const { href: _href, ...rest } = props as ButtonActionProps;\n return <PressButton {...rest} ref={ref as React.Ref<HTMLButtonElement>} />;\n});\n"]}
@@ -0,0 +1,12 @@
1
+ import * as React from "react";
2
+ import { type ButtonActionProps } from "./button.js";
3
+ export { closeLabel } from "../i18n.js";
4
+ export type CloseButtonProps = Omit<ButtonActionProps, "variant" | "iconOnly" | "iconBefore" | "iconAfter" | "children" | "aria-label"> & {
5
+ /** Overrides the localized "Close" name. */
6
+ "aria-label"?: string;
7
+ };
8
+ /** The subtle icon button with an `x` that closes a dialog, drawer, banner or toast. */
9
+ export declare const CloseButton: React.ForwardRefExoticComponent<Omit<ButtonActionProps, "children" | "aria-label" | "variant" | "iconBefore" | "iconAfter" | "iconOnly"> & {
10
+ /** Overrides the localized "Close" name. */
11
+ "aria-label"?: string;
12
+ } & React.RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { useLocale } from "react-aria-components";
5
+ import { Button } from "./button.js";
6
+ import { closeLabel } from "../i18n.js";
7
+ export { closeLabel } from "../i18n.js";
8
+ /** The subtle icon button with an `x` that closes a dialog, drawer, banner or toast. */
9
+ export const CloseButton = React.forwardRef(function CloseButton({ size = "small", "aria-label": ariaLabel, ...rest }, ref) {
10
+ const { locale } = useLocale();
11
+ return (_jsx(Button, { ...rest, ref: ref, variant: "subtle", size: size, iconOnly: true, iconBefore: "x", "aria-label": ariaLabel ?? closeLabel(locale), "data-slot": rest["data-slot"] ?? "close-button" }));
12
+ });
13
+ //# sourceMappingURL=close-button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"close-button.js","sourceRoot":"","sources":["../../src/action/close-button.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,OAAO,EAAE,MAAM,EAA0B,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAOrC,wFAAwF;AACxF,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAAC,UAAU,CAAsC,SAAS,WAAW,CACnG,EAAE,IAAI,GAAG,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EACpD,GAAG;IAEH,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,CAAC;IAC/B,OAAO,CACL,KAAC,MAAM,OACD,IAAI,EACR,GAAG,EAAE,GAAG,EACR,OAAO,EAAC,QAAQ,EAChB,IAAI,EAAE,IAAI,EACV,QAAQ,QACR,UAAU,EAAC,GAAG,gBACF,SAAS,IAAI,UAAU,CAAC,MAAM,CAAC,eAE/B,IAAiC,CAAC,WAAW,CAAC,IAAI,cAAc,GAC5E,CACH,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { useLocale } from \"react-aria-components\";\n\nimport { Button, type ButtonActionProps } from \"./button\";\nimport { closeLabel } from \"../i18n\";\n\nexport { closeLabel } from \"../i18n\";\n\nexport type CloseButtonProps = Omit<ButtonActionProps, \"variant\" | \"iconOnly\" | \"iconBefore\" | \"iconAfter\" | \"children\" | \"aria-label\"> & {\n /** Overrides the localized \"Close\" name. */\n \"aria-label\"?: string;\n};\n\n/** The subtle icon button with an `x` that closes a dialog, drawer, banner or toast. */\nexport const CloseButton = React.forwardRef<HTMLButtonElement, CloseButtonProps>(function CloseButton(\n { size = \"small\", \"aria-label\": ariaLabel, ...rest },\n ref,\n) {\n const { locale } = useLocale();\n return (\n <Button\n {...rest}\n ref={ref}\n variant=\"subtle\"\n size={size}\n iconOnly\n iconBefore=\"x\"\n aria-label={ariaLabel ?? closeLabel(locale)}\n // A part-specific slot from the parent (banner-dismiss) wins over the generic one.\n data-slot={(rest as { \"data-slot\"?: string })[\"data-slot\"] ?? \"close-button\"}\n />\n );\n});\n"]}
@@ -0,0 +1,21 @@
1
+ import * as React from "react";
2
+ import type { ComponentRadius } from "../defaults.js";
3
+ import type { ButtonSize, ButtonVariant } from "./styles.js";
4
+ export type CopyButtonProps = {
5
+ /** The text to copy, or a function that returns it (or a promise of it) at the moment of the press. */
6
+ value: string | (() => string | Promise<string>);
7
+ /** Shown as the label; left out, the button is icon-only and named by `aria-label` (default "Copy"). */
8
+ children?: React.ReactNode;
9
+ /** The name of an icon-only button: "Copy the invoice number". Default "Copy". */
10
+ "aria-label"?: string;
11
+ variant?: ButtonVariant;
12
+ size?: ButtonSize;
13
+ radius?: ComponentRadius;
14
+ /** Runs after a successful copy (to show a toast, log, …). */
15
+ onCopy?: (text: string) => void;
16
+ };
17
+ /**
18
+ * Copies text to the clipboard: the icon turns into a check for two seconds and a polite status says "Copied"
19
+ * (or that it could not copy: no permission, an insecure page). Pressing again says it again.
20
+ */
21
+ export declare function CopyButton({ value, children, "aria-label": ariaLabel, variant, size, radius, onCopy }: CopyButtonProps): React.JSX.Element;
@@ -0,0 +1,38 @@
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 { useLocale } from "react-aria-components";
5
+ import { copiedLabel, copyFailedLabel, copyLabel } from "../i18n.js";
6
+ import { Button } from "./button.js";
7
+ /**
8
+ * Copies text to the clipboard: the icon turns into a check for two seconds and a polite status says "Copied"
9
+ * (or that it could not copy: no permission, an insecure page). Pressing again says it again.
10
+ */
11
+ export function CopyButton({ value, children, "aria-label": ariaLabel, variant = "subtle", size = "small", radius, onCopy }) {
12
+ const { locale } = useLocale();
13
+ // Each press gets its own result, so pressing again re-announces even when the words are the same.
14
+ const [result, setResult] = React.useState(null);
15
+ React.useEffect(() => {
16
+ if (!result)
17
+ return;
18
+ const timer = window.setTimeout(() => setResult(null), 2000);
19
+ return () => window.clearTimeout(timer);
20
+ }, [result]);
21
+ const icon = result ? (result.ok ? "check" : "x") : "copy";
22
+ const copy = async () => {
23
+ const press = (result?.press ?? 0) + 1;
24
+ try {
25
+ const text = typeof value === "function" ? await value() : value;
26
+ await navigator.clipboard.writeText(text);
27
+ setResult({ ok: true, press });
28
+ onCopy?.(text);
29
+ }
30
+ catch {
31
+ // No permission, an insecure context or no clipboard API at all: say so.
32
+ setResult({ ok: false, press });
33
+ }
34
+ };
35
+ const message = result ? (result.ok ? copiedLabel(locale) : copyFailedLabel(locale)) : "";
36
+ return (_jsxs(_Fragment, { children: [children ? (_jsx(Button, { variant: variant, size: size, radius: radius, iconBefore: icon, "data-slot": "copy-button", "data-result": result ? (result.ok ? "copied" : "failed") : undefined, onPress: () => void copy(), children: children })) : (_jsx(Button, { variant: variant, size: size, radius: radius, iconOnly: true, iconBefore: icon, "aria-label": ariaLabel ?? copyLabel(locale), "data-slot": "copy-button", "data-result": result ? (result.ok ? "copied" : "failed") : undefined, onPress: () => void copy() })), _jsxs("span", { role: "status", "data-slot": "copy-button-status", className: "sr-only", children: [message, result && result.press % 2 === 0 ? "​" : ""] })] }));
37
+ }
38
+ //# sourceMappingURL=copy-button.js.map
@@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AC,MAAM,CAAC,eAChC,aAAa,iBACV,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,EACnE,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,IAAI,EAAE,GAC1B,CACH,EACD,gBAAM,IAAI,EAAC,QAAQ,eAAW,oBAAoB,EAAC,SAAS,EAAC,SAAS,aACnE,OAAO,EAEP,MAAM,IAAI,MAAM,CAAC,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IACvC,IACN,CACJ,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { useLocale } from \"react-aria-components\";\n\nimport { copiedLabel, copyFailedLabel, copyLabel } from \"../i18n\";\nimport type { ComponentRadius } from \"../defaults\";\nimport { Button } from \"./button\";\nimport type { ButtonSize, ButtonVariant } from \"./styles\";\n\nexport type CopyButtonProps = {\n /** The text to copy, or a function that returns it (or a promise of it) at the moment of the press. */\n value: string | (() => string | Promise<string>);\n /** Shown as the label; left out, the button is icon-only and named by `aria-label` (default \"Copy\"). */\n children?: React.ReactNode;\n /** The name of an icon-only button: \"Copy the invoice number\". Default \"Copy\". */\n \"aria-label\"?: string;\n variant?: ButtonVariant;\n size?: ButtonSize;\n radius?: ComponentRadius;\n /** Runs after a successful copy (to show a toast, log, …). */\n onCopy?: (text: string) => void;\n};\n\n/**\n * Copies text to the clipboard: the icon turns into a check for two seconds and a polite status says \"Copied\"\n * (or that it could not copy: no permission, an insecure page). Pressing again says it again.\n */\nexport function CopyButton({ value, children, \"aria-label\": ariaLabel, variant = \"subtle\", size = \"small\", radius, onCopy }: CopyButtonProps) {\n const { locale } = useLocale();\n // Each press gets its own result, so pressing again re-announces even when the words are the same.\n const [result, setResult] = React.useState<{ ok: boolean; press: number } | null>(null);\n React.useEffect(() => {\n if (!result) return;\n const timer = window.setTimeout(() => setResult(null), 2000);\n return () => window.clearTimeout(timer);\n }, [result]);\n const icon = result ? (result.ok ? \"check\" : \"x\") : \"copy\";\n const copy = async () => {\n const press = (result?.press ?? 0) + 1;\n try {\n const text = typeof value === \"function\" ? await value() : value;\n await navigator.clipboard.writeText(text);\n setResult({ ok: true, press });\n onCopy?.(text);\n } catch {\n // No permission, an insecure context or no clipboard API at all: say so.\n setResult({ ok: false, press });\n }\n };\n const message = result ? (result.ok ? copiedLabel(locale) : copyFailedLabel(locale)) : \"\";\n return (\n <>\n {children ? (\n <Button variant={variant} size={size} radius={radius} iconBefore={icon} data-slot=\"copy-button\" data-result={result ? (result.ok ? \"copied\" : \"failed\") : undefined} onPress={() => void copy()}>\n {children}\n </Button>\n ) : (\n <Button\n variant={variant}\n size={size}\n radius={radius}\n iconOnly\n iconBefore={icon}\n aria-label={ariaLabel ?? copyLabel(locale)}\n data-slot=\"copy-button\"\n data-result={result ? (result.ok ? \"copied\" : \"failed\") : undefined}\n onPress={() => void copy()}\n />\n )}\n <span role=\"status\" data-slot=\"copy-button-status\" className=\"sr-only\">\n {message}\n {/* An invisible change per press makes screen readers read the same words again. */}\n {result && result.press % 2 === 0 ? \"​\" : \"\"}\n </span>\n </>\n );\n}\n"]}
@@ -0,0 +1,29 @@
1
+ import * as React from "react";
2
+ import { type PressEvent } from "react-aria-components";
3
+ import { type IconName } from "../display/icon.js";
4
+ export type FabProps = {
5
+ /** The task, as a verb ("Contact us", "New order"), as Button's label; also the name when icon-only. */
6
+ children: string;
7
+ /** Lucide icon name before the label ("message-circle", "calendar-plus"), as Button's `iconBefore`. */
8
+ iconBefore: IconName;
9
+ onPress?: (event: PressEvent) => void;
10
+ /** A link (a chat or contact URL) instead of an action; it opens in a new tab unless `target` says otherwise. */
11
+ href?: string;
12
+ /**
13
+ * Where `href` opens. `_blank` (default) follows Link's external convention: `noopener noreferrer` and the
14
+ * new-tab words for screen readers. `_self` keeps an in-app link in the page, through the host router.
15
+ */
16
+ target?: React.HTMLAttributeAnchorTarget;
17
+ /** `fixed` (default): bottom-end above the safe area. `inline`: in the flow (previews, docs). */
18
+ placement?: "fixed" | "inline";
19
+ /** Collapse to icon-only on phones after the first scroll (default true). */
20
+ collapseOnScroll?: boolean;
21
+ /** Icon-only at every width, as Button's `iconOnly`: a round button; `label` stays its accessible name. */
22
+ iconOnly?: boolean;
23
+ };
24
+ /**
25
+ * Keeps one task reachable over scrolling content: a contact link on a
26
+ * public site, "new order" in an admin app on phones. One per screen,
27
+ * never over a dialog, sheet or a sticky summary bar (the app decides).
28
+ */
29
+ export declare const Fab: React.ForwardRefExoticComponent<FabProps & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
@@ -0,0 +1,57 @@
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, Link as AriaLink, useLocale } from "react-aria-components";
5
+ import { IconGlyph } from "../display/icon.js";
6
+ import { cn } from "../utils.js";
7
+ import { newTabLabel } from "../i18n.js";
8
+ import { LAYER } from "../layers.js";
9
+ /** The brand fill: the one tone a Fab has. */
10
+ const FILL = "bg-ds-background-brand-bold text-ds-text-on-brand data-[hovered]:bg-ds-background-brand-bold-hovered " +
11
+ "data-[pressed]:bg-ds-background-brand-bold-pressed data-[focus-visible]:inset-ring-ds-text-on-brand";
12
+ const PHONE = "(max-width: 767px)";
13
+ function useCollapsed(enabled) {
14
+ const [collapsed, setCollapsed] = React.useState(false);
15
+ React.useEffect(() => {
16
+ if (!enabled || typeof window === "undefined" || typeof window.matchMedia !== "function")
17
+ return;
18
+ const media = window.matchMedia(PHONE);
19
+ // Back at the top of the page there is room again, so the label returns.
20
+ const update = () => setCollapsed(media.matches && window.scrollY > 0);
21
+ update();
22
+ window.addEventListener("scroll", update, { passive: true });
23
+ media.addEventListener?.("change", update);
24
+ return () => {
25
+ window.removeEventListener("scroll", update);
26
+ media.removeEventListener?.("change", update);
27
+ };
28
+ }, [enabled]);
29
+ return collapsed;
30
+ }
31
+ /**
32
+ * Keeps one task reachable over scrolling content: a contact link on a
33
+ * public site, "new order" in an admin app on phones. One per screen,
34
+ * never over a dialog, sheet or a sticky summary bar (the app decides).
35
+ */
36
+ export const Fab = React.forwardRef(function Fab({ children: label, iconBefore: icon, onPress, href, target = "_blank", placement = "fixed", collapseOnScroll = true, iconOnly = false }, ref) {
37
+ const { locale } = useLocale();
38
+ const opensNewTab = Boolean(href) && target === "_blank";
39
+ const external = opensNewTab ? ` ${newTabLabel(locale)}` : "";
40
+ const scrolledAway = useCollapsed(!iconOnly && collapseOnScroll && placement === "fixed");
41
+ const collapsed = iconOnly || scrolledAway;
42
+ const className = cn("inline-flex h-12 shrink-0 items-center justify-center gap-ds-100 rounded-ds-full shadow-ds-overlay text-body-strong", "cursor-pointer select-none outline-hidden transition-[background-color,filter,padding] duration-(--ds-duration-fast) ease-ds-standard", "data-[focus-visible]:inset-ring-2", collapsed ? "w-12 px-0" : "px-ds-250",
43
+ // Over page content and a floating banner, under toasts and overlays (src/ds/layers.ts); it lifts by the
44
+ // floating banner's height while one is shown, so the banner never covers it.
45
+ placement === "fixed" &&
46
+ "fixed end-ds-300 bottom-[max(calc(var(--ds-space-300)+env(safe-area-inset-bottom,0px)),calc(var(--ds-floating-banner-offset,0px)+var(--ds-space-150)))]", placement === "fixed" && LAYER.fab, FILL);
47
+ const content = (_jsxs(_Fragment, { children: [_jsx(IconGlyph, { name: icon, size: "large", "data-slot": "fab-icon" }), !collapsed && _jsx("span", { "data-slot": "fab-label", children: label })] }));
48
+ const common = {
49
+ "data-slot": "fab",
50
+ "data-collapsed": collapsed || undefined,
51
+ // Icon-only keeps its label as the accessible name; a new tab adds Link's words after the visible label.
52
+ "aria-label": collapsed || external ? `${label}${external}` : undefined,
53
+ className,
54
+ };
55
+ return href ? (_jsx(AriaLink, { ...common, ref: ref, href: href, target: target, rel: opensNewTab ? "noopener noreferrer" : undefined, onPress: onPress, children: content })) : (_jsx(AriaButton, { ...common, ref: ref, type: "button", onPress: onPress, children: content }));
56
+ });
57
+ //# sourceMappingURL=fab.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fab.js","sourceRoot":"","sources":["../../src/action/fab.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,IAAI,IAAI,QAAQ,EAAE,SAAS,EAAmB,MAAM,uBAAuB,CAAC;AAC3G,OAAO,EAAE,SAAS,EAAiB,MAAM,iBAAiB,CAAC;AAE3D,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAGlC,8CAA8C;AAC9C,MAAM,IAAI,GACR,uGAAuG;IACvG,qGAAqG,CAAC;AAuBxG,MAAM,KAAK,GAAG,oBAAoB,CAAC;AAEnC,SAAS,YAAY,CAAC,OAAgB;IACpC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxD,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,CAAC,OAAO,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,UAAU;YAAE,OAAO;QACjG,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACvC,yEAAyE;QACzE,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC;QACvE,MAAM,EAAE,CAAC;QACT,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,OAA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K,OAAO;QACnB,yJAAyJ,EAC3J,SAAS,KAAK,OAAO,IAAI,KAAK,CAAC,GAAG,EAClC,IAAI,CACL,CAAC;IACF,MAAM,OAAO,GAAG,CACd,8BACE,KAAC,SAAS,IAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC,OAAO,eAAW,UAAU,GAAG,EAC1D,CAAC,SAAS,IAAI,4BAAgB,WAAW,YAAE,KAAK,GAAQ,IACxD,CACJ,CAAC;IACF,MAAM,MAAM,GAAG;QACb,WAAW,EAAE,KAAK;QAClB,gBAAgB,EAAE,SAAS,IAAI,SAAS;QACxC,yGAAyG;QACzG,YAAY,EAAE,SAAS,IAAI,QAAQ,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS;QACvE,SAAS;KACV,CAAC;IACF,OAAO,IAAI,CAAC,CAAC,CAAC,CACZ,KAAC,QAAQ,OACH,MAAM,EACV,GAAG,EAAE,GAAmC,EACxC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,SAAS,EACpD,OAAO,EAAE,OAAO,YAEf,OAAO,GACC,CACZ,CAAC,CAAC,CAAC,CACF,KAAC,UAAU,OAAK,MAAM,EAAE,GAAG,EAAE,GAAmC,EAAE,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,OAAO,YAC7F,OAAO,GACG,CACd,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Button as AriaButton, Link as AriaLink, useLocale, type PressEvent } from \"react-aria-components\";\nimport { IconGlyph, type IconName } from \"../display/icon\";\n\nimport { cn } from \"../utils\";\nimport { newTabLabel } from \"../i18n\";\nimport { LAYER } from \"../layers\";\n\n\n/** The brand fill: the one tone a Fab has. */\nconst FILL =\n \"bg-ds-background-brand-bold text-ds-text-on-brand data-[hovered]:bg-ds-background-brand-bold-hovered \" +\n \"data-[pressed]:bg-ds-background-brand-bold-pressed data-[focus-visible]:inset-ring-ds-text-on-brand\";\n\nexport type FabProps = {\n /** The task, as a verb (\"Contact us\", \"New order\"), as Button's label; also the name when icon-only. */\n children: string;\n /** Lucide icon name before the label (\"message-circle\", \"calendar-plus\"), as Button's `iconBefore`. */\n iconBefore: IconName;\n onPress?: (event: PressEvent) => void;\n /** A link (a chat or contact URL) instead of an action; it opens in a new tab unless `target` says otherwise. */\n href?: string;\n /**\n * Where `href` opens. `_blank` (default) follows Link's external convention: `noopener noreferrer` and the\n * new-tab words for screen readers. `_self` keeps an in-app link in the page, through the host router.\n */\n target?: React.HTMLAttributeAnchorTarget;\n /** `fixed` (default): bottom-end above the safe area. `inline`: in the flow (previews, docs). */\n placement?: \"fixed\" | \"inline\";\n /** Collapse to icon-only on phones after the first scroll (default true). */\n collapseOnScroll?: boolean;\n /** Icon-only at every width, as Button's `iconOnly`: a round button; `label` stays its accessible name. */\n iconOnly?: boolean;\n};\n\nconst PHONE = \"(max-width: 767px)\";\n\nfunction useCollapsed(enabled: boolean) {\n const [collapsed, setCollapsed] = React.useState(false);\n React.useEffect(() => {\n if (!enabled || typeof window === \"undefined\" || typeof window.matchMedia !== \"function\") return;\n const media = window.matchMedia(PHONE);\n // Back at the top of the page there is room again, so the label returns.\n const update = () => setCollapsed(media.matches && window.scrollY > 0);\n update();\n window.addEventListener(\"scroll\", update, { passive: true });\n media.addEventListener?.(\"change\", update);\n return () => {\n window.removeEventListener(\"scroll\", update);\n media.removeEventListener?.(\"change\", update);\n };\n }, [enabled]);\n return collapsed;\n}\n\n/**\n * Keeps one task reachable over scrolling content: a contact link on a\n * public site, \"new order\" in an admin app on phones. One per screen,\n * never over a dialog, sheet or a sticky summary bar (the app decides).\n */\nexport const Fab = React.forwardRef<HTMLButtonElement | HTMLAnchorElement, FabProps>(function Fab(\n { children: label, iconBefore: icon, onPress, href, target = \"_blank\", placement = \"fixed\", collapseOnScroll = true, iconOnly = false },\n ref,\n) {\n const { locale } = useLocale();\n const opensNewTab = Boolean(href) && target === \"_blank\";\n const external = opensNewTab ? ` ${newTabLabel(locale)}` : \"\";\n const scrolledAway = useCollapsed(!iconOnly && collapseOnScroll && placement === \"fixed\");\n const collapsed = iconOnly || scrolledAway;\n const className = cn(\n \"inline-flex h-12 shrink-0 items-center justify-center gap-ds-100 rounded-ds-full shadow-ds-overlay text-body-strong\",\n \"cursor-pointer select-none outline-hidden transition-[background-color,filter,padding] duration-(--ds-duration-fast) ease-ds-standard\",\n \"data-[focus-visible]:inset-ring-2\",\n collapsed ? \"w-12 px-0\" : \"px-ds-250\",\n // Over page content and a floating banner, under toasts and overlays (src/ds/layers.ts); it lifts by the\n // floating banner's height while one is shown, so the banner never covers it.\n placement === \"fixed\" &&\n \"fixed end-ds-300 bottom-[max(calc(var(--ds-space-300)+env(safe-area-inset-bottom,0px)),calc(var(--ds-floating-banner-offset,0px)+var(--ds-space-150)))]\",\n placement === \"fixed\" && LAYER.fab,\n FILL,\n );\n const content = (\n <>\n <IconGlyph name={icon} size=\"large\" data-slot=\"fab-icon\" />\n {!collapsed && <span data-slot=\"fab-label\">{label}</span>}\n </>\n );\n const common = {\n \"data-slot\": \"fab\",\n \"data-collapsed\": collapsed || undefined,\n // Icon-only keeps its label as the accessible name; a new tab adds Link's words after the visible label.\n \"aria-label\": collapsed || external ? `${label}${external}` : undefined,\n className,\n };\n return href ? (\n <AriaLink\n {...common}\n ref={ref as React.Ref<HTMLAnchorElement>}\n href={href}\n target={target}\n rel={opensNewTab ? \"noopener noreferrer\" : undefined}\n onPress={onPress}\n >\n {content}\n </AriaLink>\n ) : (\n <AriaButton {...common} ref={ref as React.Ref<HTMLButtonElement>} type=\"button\" onPress={onPress}>\n {content}\n </AriaButton>\n );\n});\n"]}
@@ -0,0 +1,70 @@
1
+ import * as React from "react";
2
+ import { type DropItem, type FileTriggerProps as AriaFileTriggerProps } from "react-aria-components";
3
+ /** Bytes as the locale writes them: "2.4 MB", "980 kB". */
4
+ export declare function formatFileSize(bytes: number, locale: string): string;
5
+ export type FileRules = {
6
+ /** MIME types or extensions: "image/jpeg", "image/*", ".heic", "application/pdf". */
7
+ acceptedFileTypes?: readonly string[];
8
+ /** Bytes. */
9
+ maxSize?: number;
10
+ };
11
+ export type RejectedFile = {
12
+ file: File;
13
+ reason: string;
14
+ };
15
+ /**
16
+ * Checks each file on its own: a wrong type or a file over `maxSize` is
17
+ * rejected with the reason, and the others are kept (design rule).
18
+ */
19
+ export declare function validateFiles(files: readonly File[], rules: FileRules, locale: string): {
20
+ accepted: File[];
21
+ rejected: RejectedFile[];
22
+ };
23
+ export type FileTriggerProps = Omit<AriaFileTriggerProps, "onSelect" | "acceptedFileTypes"> & FileRules & {
24
+ /** Files that passed the rules. */
25
+ onSelect?: (files: File[]) => void;
26
+ /** Files that did not, each with its reason. */
27
+ onReject?: (rejected: RejectedFile[]) => void;
28
+ /** The control that opens the picker: a DS Button or Link. */
29
+ children: React.ReactElement;
30
+ };
31
+ /** Opens the system file picker from any button. */
32
+ export declare function FileTrigger({ onSelect, onReject, acceptedFileTypes, maxSize, children, ...rest }: FileTriggerProps): React.JSX.Element;
33
+ export type DropZoneProps = FileRules & {
34
+ /** What to drop, as a call to action: "Drag your photos here". */
35
+ label: string;
36
+ /** The accepted types as people read them ("JPG, PNG, HEIC"); the size limit is added. */
37
+ typesLabel?: string;
38
+ allowsMultiple?: boolean;
39
+ onSelect?: (files: File[]) => void;
40
+ onReject?: (rejected: RejectedFile[]) => void;
41
+ isDisabled?: boolean;
42
+ };
43
+ /** The files among dropped items; folders, text and files the browser cannot read are skipped. */
44
+ export declare function filesFrom(items: readonly DropItem[]): Promise<File[]>;
45
+ /**
46
+ * A drop target with the picker inside: states the accepted types and the
47
+ * size limit before the user picks; while a file is over it the zone takes
48
+ * the selected fill and border.
49
+ */
50
+ export declare function DropZone({ label, typesLabel, allowsMultiple, acceptedFileTypes, maxSize, onSelect, onReject, isDisabled }: DropZoneProps): React.JSX.Element;
51
+ export type FileRowProps = {
52
+ /** The picked file; photos get a thumbnail at once, before upload ends. */
53
+ file?: File;
54
+ /** Shown name and size when there is no File object (a stored document). */
55
+ name?: string;
56
+ size?: number;
57
+ /** 0–1 while uploading; omit when done. */
58
+ progress?: number;
59
+ error?: string;
60
+ onCancel?: () => void;
61
+ onRemove?: () => void;
62
+ onReplace?: () => void;
63
+ };
64
+ /** One picked or stored file: thumbnail, name, progress or size, per-file error, one trailing action. */
65
+ export declare function FileRow({ file, name, size, progress, error, onCancel, onRemove, onReplace }: FileRowProps): React.JSX.Element;
66
+ /** The list of picked or stored files. */
67
+ export declare function FileUploadList({ children, "aria-label": ariaLabel }: {
68
+ children: React.ReactNode;
69
+ "aria-label"?: string;
70
+ }): React.JSX.Element;