@senvenli/react 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (636) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +32 -2
  3. package/dist/action/button-group.d.ts +26 -0
  4. package/dist/action/button-group.js +12 -0
  5. package/dist/action/button-group.js.map +1 -0
  6. package/dist/action/button.d.ts +42 -0
  7. package/dist/action/button.js +58 -0
  8. package/dist/action/button.js.map +1 -0
  9. package/dist/action/close-button.d.ts +12 -0
  10. package/dist/action/close-button.js +13 -0
  11. package/dist/action/close-button.js.map +1 -0
  12. package/dist/action/copy-button.d.ts +21 -0
  13. package/dist/action/copy-button.js +38 -0
  14. package/dist/action/copy-button.js.map +1 -0
  15. package/dist/action/fab.d.ts +29 -0
  16. package/dist/action/fab.js +57 -0
  17. package/dist/action/fab.js.map +1 -0
  18. package/dist/action/files.d.ts +70 -0
  19. package/dist/action/files.js +156 -0
  20. package/dist/action/files.js.map +1 -0
  21. package/dist/action/index.d.ts +23 -0
  22. package/dist/action/index.js +16 -0
  23. package/dist/action/index.js.map +1 -0
  24. package/dist/action/language-names.d.ts +19 -0
  25. package/dist/action/language-names.js +79 -0
  26. package/dist/action/language-names.js.map +1 -0
  27. package/dist/action/language-switcher.d.ts +57 -0
  28. package/dist/action/language-switcher.js +53 -0
  29. package/dist/action/language-switcher.js.map +1 -0
  30. package/dist/action/link-button.d.ts +57 -0
  31. package/dist/action/link-button.js +48 -0
  32. package/dist/action/link-button.js.map +1 -0
  33. package/dist/action/link.d.ts +24 -0
  34. package/dist/action/link.js +18 -0
  35. package/dist/action/link.js.map +1 -0
  36. package/dist/action/pressable.d.ts +40 -0
  37. package/dist/action/pressable.js +65 -0
  38. package/dist/action/pressable.js.map +1 -0
  39. package/dist/action/styles.d.ts +60 -0
  40. package/dist/action/styles.js +109 -0
  41. package/dist/action/styles.js.map +1 -0
  42. package/dist/action/theme-script.d.ts +12 -0
  43. package/dist/action/theme-script.js +23 -0
  44. package/dist/action/theme-script.js.map +1 -0
  45. package/dist/action/theme-switcher.d.ts +43 -0
  46. package/dist/action/theme-switcher.js +260 -0
  47. package/dist/action/theme-switcher.js.map +1 -0
  48. package/dist/action/theme-toggle.d.ts +43 -0
  49. package/dist/action/theme-toggle.js +259 -0
  50. package/dist/action/theme-toggle.js.map +1 -0
  51. package/dist/action/toggle.d.ts +44 -0
  52. package/dist/action/toggle.js +28 -0
  53. package/dist/action/toggle.js.map +1 -0
  54. package/dist/action/touch-target.d.ts +9 -0
  55. package/dist/action/touch-target.js +14 -0
  56. package/dist/action/touch-target.js.map +1 -0
  57. package/dist/charts/axis-width.d.ts +186 -0
  58. package/dist/charts/axis-width.js +1262 -0
  59. package/dist/charts/axis-width.js.map +1 -0
  60. package/dist/charts/bar-public.d.ts +16 -0
  61. package/dist/charts/bar-public.js +16 -0
  62. package/dist/charts/bar-public.js.map +1 -0
  63. package/dist/charts/chart-parts.d.ts +136 -0
  64. package/dist/charts/chart-parts.js +160 -0
  65. package/dist/charts/chart-parts.js.map +1 -0
  66. package/dist/charts/core-charts.d.ts +157 -0
  67. package/dist/charts/core-charts.js +505 -0
  68. package/dist/charts/core-charts.js.map +1 -0
  69. package/dist/charts/index.d.ts +12 -0
  70. package/dist/charts/index.js +8 -0
  71. package/dist/charts/index.js.map +1 -0
  72. package/dist/charts/list-charts.d.ts +124 -0
  73. package/dist/charts/list-charts.js +308 -0
  74. package/dist/charts/list-charts.js.map +1 -0
  75. package/dist/charts/more-charts.d.ts +138 -0
  76. package/dist/charts/more-charts.js +284 -0
  77. package/dist/charts/more-charts.js.map +1 -0
  78. package/dist/charts/report-charts.d.ts +138 -0
  79. package/dist/charts/report-charts.js +370 -0
  80. package/dist/charts/report-charts.js.map +1 -0
  81. package/dist/charts/value-tick.d.ts +178 -0
  82. package/dist/charts/value-tick.js +240 -0
  83. package/dist/charts/value-tick.js.map +1 -0
  84. package/dist/collection/data-table-url-hook.d.ts +34 -0
  85. package/dist/collection/data-table-url-hook.js +70 -0
  86. package/dist/collection/data-table-url-hook.js.map +1 -0
  87. package/dist/collection/data-table-url.d.ts +30 -0
  88. package/dist/collection/data-table-url.js +48 -0
  89. package/dist/collection/data-table-url.js.map +1 -0
  90. package/dist/collection/data-table.d.ts +112 -0
  91. package/dist/collection/data-table.js +188 -0
  92. package/dist/collection/data-table.js.map +1 -0
  93. package/dist/collection/grid-list-public.d.ts +18 -0
  94. package/dist/collection/grid-list-public.js +19 -0
  95. package/dist/collection/grid-list-public.js.map +1 -0
  96. package/dist/collection/grid-list.d.ts +73 -0
  97. package/dist/collection/grid-list.js +46 -0
  98. package/dist/collection/grid-list.js.map +1 -0
  99. package/dist/collection/index.d.ts +14 -0
  100. package/dist/collection/index.js +8 -0
  101. package/dist/collection/index.js.map +1 -0
  102. package/dist/collection/list.d.ts +61 -0
  103. package/dist/collection/list.js +38 -0
  104. package/dist/collection/list.js.map +1 -0
  105. package/dist/collection/selection-checkbox.d.ts +5 -0
  106. package/dist/collection/selection-checkbox.js +13 -0
  107. package/dist/collection/selection-checkbox.js.map +1 -0
  108. package/dist/collection/table.d.ts +91 -0
  109. package/dist/collection/table.js +183 -0
  110. package/dist/collection/table.js.map +1 -0
  111. package/dist/collection/tree.d.ts +31 -0
  112. package/dist/collection/tree.js +22 -0
  113. package/dist/collection/tree.js.map +1 -0
  114. package/dist/color/color.d.ts +87 -0
  115. package/dist/color/color.js +200 -0
  116. package/dist/color/color.js.map +1 -0
  117. package/dist/color/contrast.d.ts +34 -0
  118. package/dist/color/contrast.js +44 -0
  119. package/dist/color/contrast.js.map +1 -0
  120. package/dist/color/index.d.ts +4 -0
  121. package/dist/color/index.js +5 -0
  122. package/dist/color/index.js.map +1 -0
  123. package/dist/date/calendar.d.ts +71 -0
  124. package/dist/date/calendar.js +291 -0
  125. package/dist/date/calendar.js.map +1 -0
  126. package/dist/date/fields.d.ts +174 -0
  127. package/dist/date/fields.js +250 -0
  128. package/dist/date/fields.js.map +1 -0
  129. package/dist/date/index.d.ts +7 -0
  130. package/dist/date/index.js +6 -0
  131. package/dist/date/index.js.map +1 -0
  132. package/dist/date/month-grid.d.ts +31 -0
  133. package/dist/date/month-grid.js +115 -0
  134. package/dist/date/month-grid.js.map +1 -0
  135. package/dist/date/pickers.d.ts +118 -0
  136. package/dist/date/pickers.js +176 -0
  137. package/dist/date/pickers.js.map +1 -0
  138. package/dist/date/public.d.ts +25 -0
  139. package/dist/date/public.js +24 -0
  140. package/dist/date/public.js.map +1 -0
  141. package/dist/date/segments.d.ts +153 -0
  142. package/dist/date/segments.js +433 -0
  143. package/dist/date/segments.js.map +1 -0
  144. package/dist/defaults.d.ts +74 -0
  145. package/dist/defaults.js +100 -0
  146. package/dist/defaults.js.map +1 -0
  147. package/dist/density.d.ts +2 -0
  148. package/dist/density.js +2 -0
  149. package/dist/density.js.map +1 -0
  150. package/dist/display/avatar.d.ts +29 -0
  151. package/dist/display/avatar.js +71 -0
  152. package/dist/display/avatar.js.map +1 -0
  153. package/dist/display/badge.d.ts +65 -0
  154. package/dist/display/badge.js +99 -0
  155. package/dist/display/badge.js.map +1 -0
  156. package/dist/display/card.d.ts +72 -0
  157. package/dist/display/card.js +91 -0
  158. package/dist/display/card.js.map +1 -0
  159. package/dist/display/carousel.d.ts +47 -0
  160. package/dist/display/carousel.js +214 -0
  161. package/dist/display/carousel.js.map +1 -0
  162. package/dist/display/description-list.d.ts +25 -0
  163. package/dist/display/description-list.js +36 -0
  164. package/dist/display/description-list.js.map +1 -0
  165. package/dist/display/icon-aliases.d.ts +1 -0
  166. package/dist/display/icon-aliases.js +259 -0
  167. package/dist/display/icon-aliases.js.map +1 -0
  168. package/dist/display/icon-names.d.ts +4 -0
  169. package/dist/display/icon-names.js +2 -0
  170. package/dist/display/icon-names.js.map +1 -0
  171. package/dist/display/icon.d.ts +51 -0
  172. package/dist/display/icon.js +96 -0
  173. package/dist/display/icon.js.map +1 -0
  174. package/dist/display/image-crop.d.ts +106 -0
  175. package/dist/display/image-crop.js +117 -0
  176. package/dist/display/image-crop.js.map +1 -0
  177. package/dist/display/image-cropper.d.ts +68 -0
  178. package/dist/display/image-cropper.js +284 -0
  179. package/dist/display/image-cropper.js.map +1 -0
  180. package/dist/display/image-viewer.d.ts +54 -0
  181. package/dist/display/image-viewer.js +84 -0
  182. package/dist/display/image-viewer.js.map +1 -0
  183. package/dist/display/image.d.ts +26 -0
  184. package/dist/display/image.js +17 -0
  185. package/dist/display/image.js.map +1 -0
  186. package/dist/display/index.d.ts +29 -0
  187. package/dist/display/index.js +16 -0
  188. package/dist/display/index.js.map +1 -0
  189. package/dist/display/iso-chip.d.ts +19 -0
  190. package/dist/display/iso-chip.js +21 -0
  191. package/dist/display/iso-chip.js.map +1 -0
  192. package/dist/display/kbd.d.ts +11 -0
  193. package/dist/display/kbd.js +33 -0
  194. package/dist/display/kbd.js.map +1 -0
  195. package/dist/display/lozenge.d.ts +30 -0
  196. package/dist/display/lozenge.js +55 -0
  197. package/dist/display/lozenge.js.map +1 -0
  198. package/dist/display/scroll-area.d.ts +29 -0
  199. package/dist/display/scroll-area.js +95 -0
  200. package/dist/display/scroll-area.js.map +1 -0
  201. package/dist/display/separator.d.ts +13 -0
  202. package/dist/display/separator.js +24 -0
  203. package/dist/display/separator.js.map +1 -0
  204. package/dist/display/stat.d.ts +35 -0
  205. package/dist/display/stat.js +41 -0
  206. package/dist/display/stat.js.map +1 -0
  207. package/dist/display/timeline.d.ts +44 -0
  208. package/dist/display/timeline.js +111 -0
  209. package/dist/display/timeline.js.map +1 -0
  210. package/dist/display/typography.d.ts +37 -0
  211. package/dist/display/typography.js +53 -0
  212. package/dist/display/typography.js.map +1 -0
  213. package/dist/display/visually-hidden.d.ts +14 -0
  214. package/dist/display/visually-hidden.js +10 -0
  215. package/dist/display/visually-hidden.js.map +1 -0
  216. package/dist/feedback/banner.d.ts +46 -0
  217. package/dist/feedback/banner.js +157 -0
  218. package/dist/feedback/banner.js.map +1 -0
  219. package/dist/feedback/cooldown.d.ts +17 -0
  220. package/dist/feedback/cooldown.js +59 -0
  221. package/dist/feedback/cooldown.js.map +1 -0
  222. package/dist/feedback/empty-state.d.ts +35 -0
  223. package/dist/feedback/empty-state.js +39 -0
  224. package/dist/feedback/empty-state.js.map +1 -0
  225. package/dist/feedback/index.d.ts +12 -0
  226. package/dist/feedback/index.js +11 -0
  227. package/dist/feedback/index.js.map +1 -0
  228. package/dist/feedback/meter.d.ts +33 -0
  229. package/dist/feedback/meter.js +42 -0
  230. package/dist/feedback/meter.js.map +1 -0
  231. package/dist/feedback/motion.d.ts +9 -0
  232. package/dist/feedback/motion.js +57 -0
  233. package/dist/feedback/motion.js.map +1 -0
  234. package/dist/feedback/progress.d.ts +39 -0
  235. package/dist/feedback/progress.js +68 -0
  236. package/dist/feedback/progress.js.map +1 -0
  237. package/dist/feedback/skeleton.d.ts +48 -0
  238. package/dist/feedback/skeleton.js +61 -0
  239. package/dist/feedback/skeleton.js.map +1 -0
  240. package/dist/feedback/spinner.d.ts +19 -0
  241. package/dist/feedback/spinner.js +29 -0
  242. package/dist/feedback/spinner.js.map +1 -0
  243. package/dist/feedback/status-dot.d.ts +23 -0
  244. package/dist/feedback/status-dot.js +37 -0
  245. package/dist/feedback/status-dot.js.map +1 -0
  246. package/dist/form/countries.d.ts +34 -0
  247. package/dist/form/countries.js +273 -0
  248. package/dist/form/countries.js.map +1 -0
  249. package/dist/form/data-attributes.d.ts +11 -0
  250. package/dist/form/data-attributes.js +22 -0
  251. package/dist/form/data-attributes.js.map +1 -0
  252. package/dist/form/field-parts.d.ts +113 -0
  253. package/dist/form/field-parts.js +178 -0
  254. package/dist/form/field-parts.js.map +1 -0
  255. package/dist/form/field.d.ts +36 -0
  256. package/dist/form/field.js +65 -0
  257. package/dist/form/field.js.map +1 -0
  258. package/dist/form/files.d.ts +70 -0
  259. package/dist/form/files.js +156 -0
  260. package/dist/form/files.js.map +1 -0
  261. package/dist/form/form.d.ts +40 -0
  262. package/dist/form/form.js +74 -0
  263. package/dist/form/form.js.map +1 -0
  264. package/dist/form/image-crop.d.ts +106 -0
  265. package/dist/form/image-crop.js +117 -0
  266. package/dist/form/image-crop.js.map +1 -0
  267. package/dist/form/image-cropper.d.ts +68 -0
  268. package/dist/form/image-cropper.js +284 -0
  269. package/dist/form/image-cropper.js.map +1 -0
  270. package/dist/form/index.d.ts +24 -0
  271. package/dist/form/index.js +15 -0
  272. package/dist/form/index.js.map +1 -0
  273. package/dist/form/input-group.d.ts +63 -0
  274. package/dist/form/input-group.js +63 -0
  275. package/dist/form/input-group.js.map +1 -0
  276. package/dist/form/input-otp.d.ts +35 -0
  277. package/dist/form/input-otp.js +83 -0
  278. package/dist/form/input-otp.js.map +1 -0
  279. package/dist/form/input.d.ts +36 -0
  280. package/dist/form/input.js +41 -0
  281. package/dist/form/input.js.map +1 -0
  282. package/dist/form/number-field.d.ts +84 -0
  283. package/dist/form/number-field.js +81 -0
  284. package/dist/form/number-field.js.map +1 -0
  285. package/dist/form/otp-field.d.ts +37 -0
  286. package/dist/form/otp-field.js +116 -0
  287. package/dist/form/otp-field.js.map +1 -0
  288. package/dist/form/password-field.d.ts +61 -0
  289. package/dist/form/password-field.js +61 -0
  290. package/dist/form/password-field.js.map +1 -0
  291. package/dist/form/phone-field.d.ts +104 -0
  292. package/dist/form/phone-field.js +275 -0
  293. package/dist/form/phone-field.js.map +1 -0
  294. package/dist/form/phone-paste.d.ts +24 -0
  295. package/dist/form/phone-paste.js +40 -0
  296. package/dist/form/phone-paste.js.map +1 -0
  297. package/dist/form/phone.d.ts +159 -0
  298. package/dist/form/phone.js +309 -0
  299. package/dist/form/phone.js.map +1 -0
  300. package/dist/form/search-field.d.ts +29 -0
  301. package/dist/form/search-field.js +23 -0
  302. package/dist/form/search-field.js.map +1 -0
  303. package/dist/form/styles.d.ts +31 -0
  304. package/dist/form/styles.js +43 -0
  305. package/dist/form/styles.js.map +1 -0
  306. package/dist/form/text-area.d.ts +70 -0
  307. package/dist/form/text-area.js +93 -0
  308. package/dist/form/text-area.js.map +1 -0
  309. package/dist/form/text-field.d.ts +131 -0
  310. package/dist/form/text-field.js +59 -0
  311. package/dist/form/text-field.js.map +1 -0
  312. package/dist/form/validation.d.ts +145 -0
  313. package/dist/form/validation.js +136 -0
  314. package/dist/form/validation.js.map +1 -0
  315. package/dist/i18n.d.ts +438 -0
  316. package/dist/i18n.js +948 -0
  317. package/dist/i18n.js.map +1 -0
  318. package/dist/index.d.ts +9 -0
  319. package/dist/index.js +7 -0
  320. package/dist/index.js.map +1 -0
  321. package/dist/intl-locale.d.ts +30 -0
  322. package/dist/intl-locale.js +83 -0
  323. package/dist/intl-locale.js.map +1 -0
  324. package/dist/layers.d.ts +32 -0
  325. package/dist/layers.js +33 -0
  326. package/dist/layers.js.map +1 -0
  327. package/dist/layout/auth-form-layout.d.ts +71 -0
  328. package/dist/layout/auth-form-layout.js +61 -0
  329. package/dist/layout/auth-form-layout.js.map +1 -0
  330. package/dist/layout/auth-layout.d.ts +59 -0
  331. package/dist/layout/auth-layout.js +26 -0
  332. package/dist/layout/auth-layout.js.map +1 -0
  333. package/dist/layout/box.d.ts +26 -0
  334. package/dist/layout/box.js +16 -0
  335. package/dist/layout/box.js.map +1 -0
  336. package/dist/layout/grid.d.ts +27 -0
  337. package/dist/layout/grid.js +26 -0
  338. package/dist/layout/grid.js.map +1 -0
  339. package/dist/layout/index.d.ts +16 -0
  340. package/dist/layout/index.js +12 -0
  341. package/dist/layout/index.js.map +1 -0
  342. package/dist/layout/pressable.d.ts +40 -0
  343. package/dist/layout/pressable.js +65 -0
  344. package/dist/layout/pressable.js.map +1 -0
  345. package/dist/layout/reset-sent-card.d.ts +39 -0
  346. package/dist/layout/reset-sent-card.js +22 -0
  347. package/dist/layout/reset-sent-card.js.map +1 -0
  348. package/dist/layout/scroll-area.d.ts +29 -0
  349. package/dist/layout/scroll-area.js +95 -0
  350. package/dist/layout/scroll-area.js.map +1 -0
  351. package/dist/layout/section.d.ts +41 -0
  352. package/dist/layout/section.js +22 -0
  353. package/dist/layout/section.js.map +1 -0
  354. package/dist/layout/split.d.ts +50 -0
  355. package/dist/layout/split.js +35 -0
  356. package/dist/layout/split.js.map +1 -0
  357. package/dist/layout/stack.d.ts +44 -0
  358. package/dist/layout/stack.js +36 -0
  359. package/dist/layout/stack.js.map +1 -0
  360. package/dist/layout/tokens.d.ts +33 -0
  361. package/dist/layout/tokens.js +85 -0
  362. package/dist/layout/tokens.js.map +1 -0
  363. package/dist/layout/toolbar.d.ts +37 -0
  364. package/dist/layout/toolbar.js +334 -0
  365. package/dist/layout/toolbar.js.map +1 -0
  366. package/dist/navigate-context.d.ts +12 -0
  367. package/dist/navigate-context.js +13 -0
  368. package/dist/navigate-context.js.map +1 -0
  369. package/dist/navigation/accordion.d.ts +40 -0
  370. package/dist/navigation/accordion.js +33 -0
  371. package/dist/navigation/accordion.js.map +1 -0
  372. package/dist/navigation/bottom-nav.d.ts +29 -0
  373. package/dist/navigation/bottom-nav.js +48 -0
  374. package/dist/navigation/bottom-nav.js.map +1 -0
  375. package/dist/navigation/brand-link-context.d.ts +8 -0
  376. package/dist/navigation/brand-link-context.js +9 -0
  377. package/dist/navigation/brand-link-context.js.map +1 -0
  378. package/dist/navigation/breadcrumbs.d.ts +36 -0
  379. package/dist/navigation/breadcrumbs.js +51 -0
  380. package/dist/navigation/breadcrumbs.js.map +1 -0
  381. package/dist/navigation/dock.d.ts +27 -0
  382. package/dist/navigation/dock.js +47 -0
  383. package/dist/navigation/dock.js.map +1 -0
  384. package/dist/navigation/footer.d.ts +43 -0
  385. package/dist/navigation/footer.js +43 -0
  386. package/dist/navigation/footer.js.map +1 -0
  387. package/dist/navigation/index.d.ts +22 -0
  388. package/dist/navigation/index.js +17 -0
  389. package/dist/navigation/index.js.map +1 -0
  390. package/dist/navigation/language-names.d.ts +19 -0
  391. package/dist/navigation/language-names.js +79 -0
  392. package/dist/navigation/language-names.js.map +1 -0
  393. package/dist/navigation/language-switcher.d.ts +55 -0
  394. package/dist/navigation/language-switcher.js +53 -0
  395. package/dist/navigation/language-switcher.js.map +1 -0
  396. package/dist/navigation/nav-panel.d.ts +18 -0
  397. package/dist/navigation/nav-panel.js +51 -0
  398. package/dist/navigation/nav-panel.js.map +1 -0
  399. package/dist/navigation/navbar.d.ts +73 -0
  400. package/dist/navigation/navbar.js +64 -0
  401. package/dist/navigation/navbar.js.map +1 -0
  402. package/dist/navigation/page-header.d.ts +37 -0
  403. package/dist/navigation/page-header.js +50 -0
  404. package/dist/navigation/page-header.js.map +1 -0
  405. package/dist/navigation/pagination.d.ts +25 -0
  406. package/dist/navigation/pagination.js +51 -0
  407. package/dist/navigation/pagination.js.map +1 -0
  408. package/dist/navigation/panel-header.d.ts +37 -0
  409. package/dist/navigation/panel-header.js +50 -0
  410. package/dist/navigation/panel-header.js.map +1 -0
  411. package/dist/navigation/sidebar-script.d.ts +12 -0
  412. package/dist/navigation/sidebar-script.js +20 -0
  413. package/dist/navigation/sidebar-script.js.map +1 -0
  414. package/dist/navigation/sidebar.d.ts +149 -0
  415. package/dist/navigation/sidebar.js +332 -0
  416. package/dist/navigation/sidebar.js.map +1 -0
  417. package/dist/navigation/skip-link.d.ts +12 -0
  418. package/dist/navigation/skip-link.js +30 -0
  419. package/dist/navigation/skip-link.js.map +1 -0
  420. package/dist/navigation/stepper.d.ts +50 -0
  421. package/dist/navigation/stepper.js +96 -0
  422. package/dist/navigation/stepper.js.map +1 -0
  423. package/dist/navigation/tabs.d.ts +84 -0
  424. package/dist/navigation/tabs.js +118 -0
  425. package/dist/navigation/tabs.js.map +1 -0
  426. package/dist/navigation/toolbar.d.ts +37 -0
  427. package/dist/navigation/toolbar.js +334 -0
  428. package/dist/navigation/toolbar.js.map +1 -0
  429. package/dist/overlay/alert-dialog.d.ts +63 -0
  430. package/dist/overlay/alert-dialog.js +76 -0
  431. package/dist/overlay/alert-dialog.js.map +1 -0
  432. package/dist/overlay/command-palette.d.ts +53 -0
  433. package/dist/overlay/command-palette.js +130 -0
  434. package/dist/overlay/command-palette.js.map +1 -0
  435. package/dist/overlay/command.d.ts +53 -0
  436. package/dist/overlay/command.js +129 -0
  437. package/dist/overlay/command.js.map +1 -0
  438. package/dist/overlay/context-menu.d.ts +29 -0
  439. package/dist/overlay/context-menu.js +58 -0
  440. package/dist/overlay/context-menu.js.map +1 -0
  441. package/dist/overlay/dialog.d.ts +162 -0
  442. package/dist/overlay/dialog.js +174 -0
  443. package/dist/overlay/dialog.js.map +1 -0
  444. package/dist/overlay/drawer.d.ts +41 -0
  445. package/dist/overlay/drawer.js +114 -0
  446. package/dist/overlay/drawer.js.map +1 -0
  447. package/dist/overlay/floating.d.ts +142 -0
  448. package/dist/overlay/floating.js +226 -0
  449. package/dist/overlay/floating.js.map +1 -0
  450. package/dist/overlay/hover-card.d.ts +19 -0
  451. package/dist/overlay/hover-card.js +31 -0
  452. package/dist/overlay/hover-card.js.map +1 -0
  453. package/dist/overlay/index.d.ts +18 -0
  454. package/dist/overlay/index.js +12 -0
  455. package/dist/overlay/index.js.map +1 -0
  456. package/dist/overlay/overlay-base.d.ts +105 -0
  457. package/dist/overlay/overlay-base.js +250 -0
  458. package/dist/overlay/overlay-base.js.map +1 -0
  459. package/dist/overlay/overlay.d.ts +299 -0
  460. package/dist/overlay/overlay.js +558 -0
  461. package/dist/overlay/overlay.js.map +1 -0
  462. package/dist/overlay/toast.d.ts +58 -0
  463. package/dist/overlay/toast.js +145 -0
  464. package/dist/overlay/toast.js.map +1 -0
  465. package/dist/provider.d.ts +26 -0
  466. package/dist/provider.js +30 -0
  467. package/dist/provider.js.map +1 -0
  468. package/dist/selection/autocomplete.d.ts +54 -0
  469. package/dist/selection/autocomplete.js +122 -0
  470. package/dist/selection/autocomplete.js.map +1 -0
  471. package/dist/selection/checkbox.d.ts +56 -0
  472. package/dist/selection/checkbox.js +49 -0
  473. package/dist/selection/checkbox.js.map +1 -0
  474. package/dist/selection/choice-size.d.ts +26 -0
  475. package/dist/selection/choice-size.js +50 -0
  476. package/dist/selection/choice-size.js.map +1 -0
  477. package/dist/selection/choice-text.d.ts +21 -0
  478. package/dist/selection/choice-text.js +33 -0
  479. package/dist/selection/choice-text.js.map +1 -0
  480. package/dist/selection/combobox.d.ts +173 -0
  481. package/dist/selection/combobox.js +410 -0
  482. package/dist/selection/combobox.js.map +1 -0
  483. package/dist/selection/index.d.ts +20 -0
  484. package/dist/selection/index.js +13 -0
  485. package/dist/selection/index.js.map +1 -0
  486. package/dist/selection/list-box.d.ts +30 -0
  487. package/dist/selection/list-box.js +16 -0
  488. package/dist/selection/list-box.js.map +1 -0
  489. package/dist/selection/listbox.d.ts +44 -0
  490. package/dist/selection/listbox.js +49 -0
  491. package/dist/selection/listbox.js.map +1 -0
  492. package/dist/selection/match.d.ts +20 -0
  493. package/dist/selection/match.js +57 -0
  494. package/dist/selection/match.js.map +1 -0
  495. package/dist/selection/multi-select.d.ts +72 -0
  496. package/dist/selection/multi-select.js +138 -0
  497. package/dist/selection/multi-select.js.map +1 -0
  498. package/dist/selection/radio-card.d.ts +31 -0
  499. package/dist/selection/radio-card.js +29 -0
  500. package/dist/selection/radio-card.js.map +1 -0
  501. package/dist/selection/radio.d.ts +72 -0
  502. package/dist/selection/radio.js +64 -0
  503. package/dist/selection/radio.js.map +1 -0
  504. package/dist/selection/select-public.d.ts +19 -0
  505. package/dist/selection/select-public.js +24 -0
  506. package/dist/selection/select-public.js.map +1 -0
  507. package/dist/selection/select.d.ts +72 -0
  508. package/dist/selection/select.js +69 -0
  509. package/dist/selection/select.js.map +1 -0
  510. package/dist/selection/slider.d.ts +16 -0
  511. package/dist/selection/slider.js +44 -0
  512. package/dist/selection/slider.js.map +1 -0
  513. package/dist/selection/styles.d.ts +26 -0
  514. package/dist/selection/styles.js +78 -0
  515. package/dist/selection/styles.js.map +1 -0
  516. package/dist/selection/switch.d.ts +24 -0
  517. package/dist/selection/switch.js +27 -0
  518. package/dist/selection/switch.js.map +1 -0
  519. package/dist/selection/tag-group.d.ts +38 -0
  520. package/dist/selection/tag-group.js +45 -0
  521. package/dist/selection/tag-group.js.map +1 -0
  522. package/dist/tone.d.ts +6 -0
  523. package/dist/tone.js +2 -0
  524. package/dist/tone.js.map +1 -0
  525. package/dist/utils.d.ts +9 -0
  526. package/dist/utils.js +42 -0
  527. package/dist/utils.js.map +1 -0
  528. package/manifest/component.full.schema.json +391 -0
  529. package/manifest/component.schema.json +279 -0
  530. package/manifests/accordion.json +299 -0
  531. package/manifests/alert-dialog.json +261 -0
  532. package/manifests/area-chart.json +338 -0
  533. package/manifests/autocomplete.json +299 -0
  534. package/manifests/avatar.json +253 -0
  535. package/manifests/badge.json +288 -0
  536. package/manifests/banner.json +185 -0
  537. package/manifests/bar-chart.json +454 -0
  538. package/manifests/bar-list.json +262 -0
  539. package/manifests/bottom-nav.json +139 -0
  540. package/manifests/box.json +3450 -0
  541. package/manifests/breadcrumbs.json +199 -0
  542. package/manifests/button-group.json +2294 -0
  543. package/manifests/button.json +1211 -0
  544. package/manifests/calendar-heatmap.json +218 -0
  545. package/manifests/calendar.json +299 -0
  546. package/manifests/card.json +308 -0
  547. package/manifests/carousel.json +263 -0
  548. package/manifests/chart-parts.json +309 -0
  549. package/manifests/checkbox.json +998 -0
  550. package/manifests/close-button.json +1000 -0
  551. package/manifests/color-field.json +276 -0
  552. package/manifests/color-picker.json +161 -0
  553. package/manifests/color-swatch-picker.json +220 -0
  554. package/manifests/color-swatch.json +140 -0
  555. package/manifests/combobox.json +581 -0
  556. package/manifests/command.json +275 -0
  557. package/manifests/composed-chart.json +287 -0
  558. package/manifests/context-menu.json +148 -0
  559. package/manifests/copy-button.json +192 -0
  560. package/manifests/data-table.json +334 -0
  561. package/manifests/date-field.json +302 -0
  562. package/manifests/date-picker.json +472 -0
  563. package/manifests/description-list.json +201 -0
  564. package/manifests/dialog.json +322 -0
  565. package/manifests/donut-chart.json +264 -0
  566. package/manifests/drawer.json +211 -0
  567. package/manifests/empty-state.json +185 -0
  568. package/manifests/fab.json +172 -0
  569. package/manifests/field.json +209 -0
  570. package/manifests/file-upload.json +791 -0
  571. package/manifests/form.json +829 -0
  572. package/manifests/funnel-chart.json +223 -0
  573. package/manifests/gauge-chart.json +252 -0
  574. package/manifests/grid-list.json +335 -0
  575. package/manifests/grid.json +3482 -0
  576. package/manifests/heading.json +183 -0
  577. package/manifests/heatmap.json +265 -0
  578. package/manifests/hover-card.json +172 -0
  579. package/manifests/icon.json +201 -0
  580. package/manifests/image-cropper.json +295 -0
  581. package/manifests/image-viewer.json +198 -0
  582. package/manifests/image.json +193 -0
  583. package/manifests/index.json +2035 -0
  584. package/manifests/input-group.json +3571 -0
  585. package/manifests/input.json +1557 -0
  586. package/manifests/kbd.json +98 -0
  587. package/manifests/language-switcher.json +274 -0
  588. package/manifests/line-chart.json +342 -0
  589. package/manifests/link.json +867 -0
  590. package/manifests/list-box.json +213 -0
  591. package/manifests/menu.json +453 -0
  592. package/manifests/meter.json +145 -0
  593. package/manifests/navbar.json +281 -0
  594. package/manifests/otp-field.json +1029 -0
  595. package/manifests/page-header.json +164 -0
  596. package/manifests/pagination.json +181 -0
  597. package/manifests/popover.json +205 -0
  598. package/manifests/pressable.json +367 -0
  599. package/manifests/progress.json +282 -0
  600. package/manifests/radar-chart.json +229 -0
  601. package/manifests/radial-chart.json +195 -0
  602. package/manifests/radio.json +975 -0
  603. package/manifests/scatter-chart.json +277 -0
  604. package/manifests/scroll-area.json +127 -0
  605. package/manifests/section.json +169 -0
  606. package/manifests/select.json +474 -0
  607. package/manifests/separator.json +119 -0
  608. package/manifests/sidebar.json +584 -0
  609. package/manifests/skeleton.json +235 -0
  610. package/manifests/skip-link.json +89 -0
  611. package/manifests/slider.json +706 -0
  612. package/manifests/sparkline.json +208 -0
  613. package/manifests/spinner.json +105 -0
  614. package/manifests/split.json +6618 -0
  615. package/manifests/stack.json +3541 -0
  616. package/manifests/stat.json +192 -0
  617. package/manifests/stepper.json +279 -0
  618. package/manifests/switch.json +205 -0
  619. package/manifests/table.json +375 -0
  620. package/manifests/tabs.json +438 -0
  621. package/manifests/tag-group.json +264 -0
  622. package/manifests/text-area.json +1136 -0
  623. package/manifests/text.json +244 -0
  624. package/manifests/theme-switcher.json +152 -0
  625. package/manifests/time-field.json +284 -0
  626. package/manifests/timeline.json +196 -0
  627. package/manifests/toast.json +87 -0
  628. package/manifests/toggle-button.json +1489 -0
  629. package/manifests/toolbar.json +145 -0
  630. package/manifests/tooltip.json +181 -0
  631. package/manifests/tracker.json +192 -0
  632. package/manifests/tree.json +245 -0
  633. package/manifests/visually-hidden.json +114 -0
  634. package/package.json +117 -3
  635. package/styles/base.css +56 -0
  636. package/styles/theme.css +154 -0
@@ -0,0 +1,178 @@
1
+ import * as React from "react";
2
+ /**
3
+ * @internal The dy of a label's first line, as Recharts' Text sets it: lines stacked from the anchor (`start`, an
4
+ * x-axis tick under the axis), centered on it (`middle`, a y-axis tick, a bar-end label), or ending at it, plus
5
+ * the cap height (0.71em) that puts the text's middle, top or baseline there. Shared by the value ticks and the
6
+ * bar-end labels, so both sit exactly where Recharts drew them.
7
+ */
8
+ export declare function firstLineDy(lines: number, anchor?: "start" | "middle" | "end"): string;
9
+ /** What Recharts hands a custom tick (CartesianAxis), and what the chart sets on it. */
10
+ export type ValueTickProps = {
11
+ x?: number | string;
12
+ y?: number | string;
13
+ /** The room the tick has: the axis's, or the chart's own (axis-width's tickWrapWidth). */
14
+ width?: number | string;
15
+ height?: number | string;
16
+ payload?: {
17
+ value?: unknown;
18
+ };
19
+ index?: number;
20
+ tickFormatter?: (value: never, index: number) => React.ReactNode;
21
+ textAnchor?: "start" | "middle" | "end" | "inherit";
22
+ verticalAnchor?: "start" | "middle" | "end";
23
+ fill?: string;
24
+ stroke?: string;
25
+ fontSize?: number | string;
26
+ style?: React.CSSProperties;
27
+ /**
28
+ * The values of every tick the axis draws, as the chart predicts them (axis-width's valueAxisTicks, as it sizes
29
+ * the axis): when one of them needs a compact figure, every tick of the axis shows one.
30
+ */
31
+ axisTicks?: readonly number[];
32
+ };
33
+ /**
34
+ * @internal A value axis's tick, in place of Recharts' own Text, which wrapped a tick at any space
35
+ * once it passed its room: at the 128px clamp "€ 150.000.000.000.000" stood as "€" over "150.000.000.000.000",
36
+ * the figure running past the axis's edge. This one lays the tick out by the bar-end labels' rule (axis-width's
37
+ * textUnits: a currency, a sign and a figure are one unit) and, when a unit does not fit, shows the axis's figures
38
+ * compact and exact in the chart's locale (`tickText`), with the whole tick as the text's accessible name and hover
39
+ * title. Pure: it measures nothing, so the server, the first render and every later one draw the same. Drawn as
40
+ * Recharts draws a tick (a `recharts-cartesian-axis-tick-value` text with a tspan a line), so a tick that fits is
41
+ * where and as it was; only the orientation attribute Recharts' Text passed through is not set.
42
+ *
43
+ * On a vertical axis, a line still wider than the room, by the estimate (a formatter's long word against a figure,
44
+ * which no shortening may cut), is clipped to the room: the room runs from where Recharts anchors the tick, beside the
45
+ * plot, to the axis's outer edge, so a clipped tick never stands over the plot nor past the chart's edge. Each line is
46
+ * drawn from the room's edge where it starts to read ({@link clippedLine}), so its reading start, the currency and
47
+ * figure a formatter writes first, stays in view, and the tick carries the whole tick as its accessible name and
48
+ * hover title, as a shortened one does. Under the plot (a horizontal axis) nothing clips a tick, so it is at most
49
+ * compact (axis-width's tickText): never in scientific notation nor shortened with "…".
50
+ *
51
+ * Every line, clipped or not, is drawn in its own reading direction, isolated ({@link LineSpan}), where Recharts
52
+ * anchors it: "\u200f١٥٠ ترليون €" reads from the right with its "€" at its end, on the left, in the left-to-right plot.
53
+ */
54
+ export declare function ValueTick({ x, y, width, height, payload, index, tickFormatter, textAnchor, verticalAnchor, fill, stroke, fontSize, style, axisTicks }: ValueTickProps): React.JSX.Element | null;
55
+ type Direction = "ltr" | "rtl";
56
+ type Anchor = "start" | "middle" | "end";
57
+ /**
58
+ * @internal A line as it is drawn: at `x`, in its own `direction`, with the `text-anchor` that, in that direction, puts
59
+ * it where the chart anchors it. `x` as Recharts gives it (a number, or a string it passes through).
60
+ */
61
+ export type PlacedLine = {
62
+ x: number | string | undefined;
63
+ direction: Direction;
64
+ anchor: Anchor;
65
+ };
66
+ /**
67
+ * @internal The direction a tick's or label's line reads in, from its own text (axis-width's readsRightToLeft: its
68
+ * first letter, figure or direction mark): "rtl" for "\u200f١٥٠ ترليون €", "‏1.5E14 €", "١٥٠ ترليون"; "ltr" for
69
+ * "€ 1.450.000", "€ 1,5 ترليون", "12 млн km / h".
70
+ */
71
+ export declare function lineDirection(line: string): Direction;
72
+ /**
73
+ * @internal The `text-anchor` that keeps a line of this direction where `anchor` puts a line in the plot, which is laid
74
+ * out left to right (chart-parts): a line's `start` is its left in "ltr" and its right in "rtl" (SVG 2's text-anchor:
75
+ * the start of a text chunk is the side its direction starts from; Chromium anchors a tspan by its own direction and
76
+ * text-anchor, checked in Chromium). So "end" (a left-hand axis's ticks, their
77
+ * right edge at the plot) is "start" for a line read from the right, and "start" (a right-hand axis's, a bar-end label
78
+ * running forward) is "end"; "middle" is "middle" either way.
79
+ */
80
+ export declare function anchorFor(anchor: Anchor | "inherit" | undefined, direction: Direction): Anchor;
81
+ /** @internal A line that is not clipped: in its own direction, where Recharts anchors it (`anchor` as the plot's left-to-right text has it). */
82
+ export declare function placedLine(line: string, x: number | string | undefined, anchor: Anchor | "inherit" | undefined): PlacedLine;
83
+ /**
84
+ * @internal Where a clipped line is drawn, for a value tick and a bar-end label alike: from one edge
85
+ * of its clip, in that edge's direction, as its own isolated paragraph (`direction`, `unicode-bidi: isolate`, drawn
86
+ * from the text's `start` anchor). The plot is laid out left to right (chart-parts), so a line that starts to read
87
+ * from the right ("\u200f١٥٠ ترليون €xxxx") was drawn with its right-to-left run on the left and its Latin tail on the
88
+ * right: anchored at the clip's right edge, the tail stayed in view and the figure was clipped. The direction is the
89
+ * one in which the line's first character is drawn inside the clip (axis-width's clipDirection): "rtl" from the
90
+ * clip's right edge for that line, "ltr" from its left edge for one that reads from the left, a right-to-left run
91
+ * within it ("€ 1,5 ترليون xxxx") or not, and for a right-to-left mark before a left-to-right figure
92
+ * ("\u200f1.45M €xxxx"). `start` is the clip's left edge, `width` its width.
93
+ */
94
+ export declare function clippedLine(line: string, start: number, width: number, figures: "proportional" | "tabular"): PlacedLine;
95
+ /**
96
+ * @internal A tick's or label's line: every line, clipped or not, its own isolated paragraph in its own
97
+ * direction (`direction`, `unicode-bidi: isolate`), so it reads as its text does whatever the lines around it hold:
98
+ * "\u200f١٥٠ ترليون €" from the right, its "€" at its end on the left, where the plot's left-to-right paragraph drew
99
+ * its "€" on the right, after "١٥٠", a figure-first reading. Its `text-anchor` is set where its direction needs another
100
+ * than the text's (`inherited`) to stand where the text is anchored ({@link anchorFor}); a line read from the left
101
+ * needs none, so it is drawn exactly as before.
102
+ */
103
+ export declare function LineSpan({ x, direction, anchor, inherited, dy, children }: PlacedLine & {
104
+ inherited: Anchor | "inherit" | undefined;
105
+ dy: string;
106
+ children: string;
107
+ }): React.JSX.Element;
108
+ /**
109
+ * @internal The style that keeps a tick centered under the plot at `x` inside the chart's edges, 0 and `edge`, by its
110
+ * drawn width, or none where it needs none. The tick stays centered on its gridline and a CSS
111
+ * translation, resolved by the browser against the text's own box (`transform-box: fill-box`, so 50% is half its drawn
112
+ * width), moves it in only by what it passes an edge: `clamp(50% + 0.075em − x, 0, edge − x − 0.075em − 50%)`, 0 for a
113
+ * tick that stands inside them. The box is centered on the gridline but for a glyph's overhang past its advance on one
114
+ * side (at most 0.142em, Arial's "ʃʃ"; 1px for a formatted value, measured in Chromium for Geist, Arial, Noto Sans,
115
+ * DejaVu Sans, Nimbus Sans and the system faces), which shifts the box's center by half that at most: hence 0.075em.
116
+ * So a tick never passes an edge, and one whose box stands more than 0.075em (0.83px at 11px) inside both edges stays
117
+ * on its gridline exactly, whatever the face; one nearer an edge moves in by at most that. Nothing is measured in
118
+ * script: the server and the first render write the same markup. Only where its estimated width (axis-width's
119
+ * textWidth, an upper bound) could reach that margin is the style set, so every other tick is drawn exactly as Recharts
120
+ * drew it. A tick wider than the whole chart (none is: axis-width's tickText keeps its lines within `edge`) would stand
121
+ * at the chart's start.
122
+ */
123
+ export declare function edgeShift(lines: readonly string[], x: number, edge: number, fontSize?: number): React.CSSProperties | undefined;
124
+ /**
125
+ * @internal The lines an x band `band` px tall holds for this tick under the plot (the x band): its first
126
+ * line's baseline 0.71em under the 8px inset (firstLineDy "start"), each further line 1em lower, and the last line's
127
+ * box inside the band, so no line passes the svg's bottom, an axis name or the legend below, in any face: its descent
128
+ * the most any face's reaches ({@link descentEm}), rounded up to a whole pixel, as Chromium rounds a face's descent at
129
+ * the scale it draws it (so at any device pixel ratio). At least one. Recharts' default band (30px) holds one line of
130
+ * any script at 11px (two of Latin would need 31px: 8 + 7.81 + 11 + 4).
131
+ */
132
+ export declare function bandLines(text: string, band: number, fontSize?: number): number;
133
+ /**
134
+ * @internal A category axis's tick under the plot (periods, steps), drawn as Recharts draws it, kept inside the chart:
135
+ * Recharts centers a tick on its period, so the last one (on the plot's edge, or in a narrow band)
136
+ * could stand past the chart's edge ("Sep" by 0.7px, a waterfall's "Closing" at 320px). It stays at Recharts' x, on
137
+ * its band's center, and takes the value ticks' CSS clamp ({@link edgeShift})
138
+ * where its estimated width could reach an edge: the browser moves it in by its drawn width only as far
139
+ * as it passes the edge, so a tick that fits stays exactly centered (moved by the estimate, an upper bound, it stood
140
+ * off its band's center) and none passes the edge. Line and area charts also give the last period the room for its
141
+ * half (core-charts' edgeMargin), so theirs never moves.
142
+ */
143
+ export declare function CategoryTick({ x, y, width, height, payload, index, tickFormatter, textAnchor, verticalAnchor, fill, stroke, fontSize, style }: ValueTickProps): React.JSX.Element | null;
144
+ /**
145
+ * @internal A category name beside the plot (a horizontal BarChart's regions) or around it (a RadarChart's
146
+ * dimensions), drawn by Recharts' own Text as Recharts draws it (its own wrapping, measured), as its own isolated
147
+ * paragraph in the name's reading direction ({@link lineDirection}), anchored where Recharts anchors it
148
+ * ({@link anchorFor}): a name read from the right reads so, its marks and figures where it writes them,
149
+ * in the left-to-right plot. Its lines are the one name's, in the name's direction. `polar` for a RadarChart's, which
150
+ * Recharts classes as its angle axis's.
151
+ */
152
+ export declare function NameTick({ payload, index, tickFormatter, textAnchor, polar, ...props }: ValueTickProps & {
153
+ className?: string;
154
+ polar?: boolean;
155
+ [prop: string]: unknown;
156
+ }): React.JSX.Element | null;
157
+ /** Where Recharts anchors a cartesian label at these positions (its getCartesianPosition, for a box of positive width). */
158
+ declare const LABEL_ANCHOR: {
159
+ readonly top: "middle";
160
+ readonly insideBottom: "middle";
161
+ readonly insideLeft: "start";
162
+ readonly insideBottomLeft: "start";
163
+ readonly insideRight: "end";
164
+ readonly insideBottomRight: "end";
165
+ };
166
+ /**
167
+ * @internal The props that give a Recharts label (a ScatterChart's axis name, a reference line's label) its own isolated
168
+ * direction, as {@link NameTick} gives a name: `direction` from its text ({@link lineDirection}),
169
+ * `unicode-bidi: isolate`, and the `text-anchor` that keeps it where Recharts puts a label at `position` in the
170
+ * left-to-right plot ({@link anchorFor}; Recharts takes a label's own `textAnchor` over the position's). A label read
171
+ * from the left keeps the position's anchor, so it is drawn as before. Spread into the label's props.
172
+ */
173
+ export declare function isolatedLabel(text: string | undefined, position: keyof typeof LABEL_ANCHOR): {
174
+ direction: Direction;
175
+ unicodeBidi: "isolate";
176
+ textAnchor: Anchor;
177
+ };
178
+ export {};
@@ -0,0 +1,240 @@
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 { Text, useChartWidth } from "recharts";
6
+ import { TICK_INSET, chartNumber, clipDirection, formattedValues, readsRightToLeft, textWidth, tickText } from "./axis-width.js";
7
+ /**
8
+ * @internal The dy of a label's first line, as Recharts' Text sets it: lines stacked from the anchor (`start`, an
9
+ * x-axis tick under the axis), centered on it (`middle`, a y-axis tick, a bar-end label), or ending at it, plus
10
+ * the cap height (0.71em) that puts the text's middle, top or baseline there. Shared by the value ticks and the
11
+ * bar-end labels, so both sit exactly where Recharts drew them.
12
+ */
13
+ export function firstLineDy(lines, anchor = "middle") {
14
+ const em = anchor === "start" ? 0.71 : anchor === "middle" ? (1 - lines) / 2 + 0.355 : 1 - lines;
15
+ return `${Math.round(em * 1000) / 1000}em`;
16
+ }
17
+ /**
18
+ * @internal A value axis's tick, in place of Recharts' own Text, which wrapped a tick at any space
19
+ * once it passed its room: at the 128px clamp "€ 150.000.000.000.000" stood as "€" over "150.000.000.000.000",
20
+ * the figure running past the axis's edge. This one lays the tick out by the bar-end labels' rule (axis-width's
21
+ * textUnits: a currency, a sign and a figure are one unit) and, when a unit does not fit, shows the axis's figures
22
+ * compact and exact in the chart's locale (`tickText`), with the whole tick as the text's accessible name and hover
23
+ * title. Pure: it measures nothing, so the server, the first render and every later one draw the same. Drawn as
24
+ * Recharts draws a tick (a `recharts-cartesian-axis-tick-value` text with a tspan a line), so a tick that fits is
25
+ * where and as it was; only the orientation attribute Recharts' Text passed through is not set.
26
+ *
27
+ * On a vertical axis, a line still wider than the room, by the estimate (a formatter's long word against a figure,
28
+ * which no shortening may cut), is clipped to the room: the room runs from where Recharts anchors the tick, beside the
29
+ * plot, to the axis's outer edge, so a clipped tick never stands over the plot nor past the chart's edge. Each line is
30
+ * drawn from the room's edge where it starts to read ({@link clippedLine}), so its reading start, the currency and
31
+ * figure a formatter writes first, stays in view, and the tick carries the whole tick as its accessible name and
32
+ * hover title, as a shortened one does. Under the plot (a horizontal axis) nothing clips a tick, so it is at most
33
+ * compact (axis-width's tickText): never in scientific notation nor shortened with "…".
34
+ *
35
+ * Every line, clipped or not, is drawn in its own reading direction, isolated ({@link LineSpan}), where Recharts
36
+ * anchors it: "\u200f١٥٠ ترليون €" reads from the right with its "€" at its end, on the left, in the left-to-right plot.
37
+ */
38
+ export function ValueTick({ x, y, width, height, payload, index = 0, tickFormatter, textAnchor, verticalAnchor = "middle", fill, stroke, fontSize, style, axisTicks }) {
39
+ const { locale } = useLocale();
40
+ const chartWidth = useChartWidth();
41
+ const clipId = `ds-value-tick-${React.useId().replace(/[^\w-]/g, "")}`;
42
+ if (x == null || y == null || !payload)
43
+ return null;
44
+ const format = (value, at) => String(typeof tickFormatter === "function" ? tickFormatter(value, at) : value);
45
+ const full = format(payload.value, index);
46
+ const room = width == null || width === "" || !Number.isFinite(Number(width)) ? Number.POSITIVE_INFINITY : Number(width);
47
+ // The values the axis's ticks were formatted from, as the chart sized the axis from them: what proves how the
48
+ // formatter writes its marks (axis-width's markRoles).
49
+ const values = new Map(formattedValues(axisTicks ?? [], (value) => format(value, 0)));
50
+ const own = chartNumber(payload.value);
51
+ if (own !== undefined)
52
+ values.set(full, own);
53
+ // Only beside the plot (a vertical axis, anchored at its start or end) is a tick clipped: under the plot a tick's room
54
+ // is the whole axis, not a band of its own, and only the chart's edge bounds it (it moves in from the edges, below),
55
+ // so a tick there is at most compact, never scientific, never "…", unless it is wider than the whole chart.
56
+ const beside = textAnchor === "start" || textAnchor === "end";
57
+ // Under the plot the band Recharts gives the axis (its height, 30px by default) holds its lines under the 8px inset:
58
+ // a tick that would take more is laid out wider in no more, never past the svg's bottom nor into an axis name or
59
+ // the legend below (axis-width's linesWithin; bandLines).
60
+ const band = Number(height);
61
+ const maxLines = beside || !(band > 0) ? Number.POSITIVE_INFINITY : bandLines(full, band, Number(fontSize) > 0 ? Number(fontSize) : TICK_FONT);
62
+ const edge = beside || chartWidth === undefined || !(chartWidth > 0) ? undefined : chartWidth;
63
+ const { lines, shortened } = tickText(full, room, locale, axisTicks?.map((value) => format(value, 0)), values, beside, maxLines, edge);
64
+ const clipped = beside && Number.isFinite(room) && Number.isFinite(Number(x)) && lines.some((line) => textWidth(line, "tabular") > room);
65
+ // The room along the line: Recharts anchors a tick at the plot's side of it (its end on a left-hand axis, its start
66
+ // on a right-hand one).
67
+ const anchorX = Number(x);
68
+ const roomStart = textAnchor === "end" ? anchorX - room : anchorX;
69
+ const anchor = clipped ? "start" : textAnchor;
70
+ // Under the plot, centered on its value, a tick moves in from the chart's edges just far enough to stand inside them
71
+ // (a tick wider than its room passed the chart's edge, which Recharts' spacing, measured on other text,
72
+ // did not prevent), by its drawn width, not the estimate (moved by the estimate, an upper bound, a
73
+ // tick that fit stood 2–14px off its gridline): see edgeShift.
74
+ const shift = textAnchor === "middle" && edge !== undefined && Number.isFinite(anchorX) ? edgeShift(lines, anchorX, edge, Number(fontSize) > 0 ? Number(fontSize) : TICK_FONT) : undefined;
75
+ const lineAt = (line) => (clipped ? clippedLine(line, roomStart, room, "tabular") : placedLine(line, x, textAnchor));
76
+ const drawX = lineAt(lines[0] ?? "").x;
77
+ const named = shortened || clipped;
78
+ const lineBox = (lines.length + 1) * TICK_FONT;
79
+ return (_jsxs(_Fragment, { children: [clipped && (_jsx("clipPath", { id: clipId, children: _jsx("rect", { x: roomStart, y: Number(y) - lineBox, width: room, height: lineBox * 2 }) })), _jsxs("text", { x: drawX, y: y, width: width, height: height, stroke: stroke, fill: fill, fontSize: fontSize, style: shift ? { ...style, ...shift } : style, textAnchor: anchor,
80
+ // Recharts' own tick's classes (its Text takes no axis classes), so a tick looks and is found as before.
81
+ className: "recharts-text recharts-cartesian-axis-tick-value", "data-slot": "chart-value-tick", "data-shortened": shortened || undefined, "data-clipped": clipped || undefined, clipPath: clipped ? `url(#${clipId})` : undefined, "aria-label": named ? full : undefined, children: [named && _jsx("title", { children: full }), lines.map((line, at) => (_jsx(LineSpan, { ...lineAt(line), inherited: anchor, dy: at === 0 ? firstLineDy(lines.length, verticalAnchor) : "1em", children: line }, at)))] })] }));
82
+ }
83
+ /**
84
+ * @internal The direction a tick's or label's line reads in, from its own text (axis-width's readsRightToLeft: its
85
+ * first letter, figure or direction mark): "rtl" for "\u200f١٥٠ ترليون €", "‏1.5E14 €", "١٥٠ ترليون"; "ltr" for
86
+ * "€ 1.450.000", "€ 1,5 ترليون", "12 млн km / h".
87
+ */
88
+ export function lineDirection(line) {
89
+ return readsRightToLeft(line) ? "rtl" : "ltr";
90
+ }
91
+ /**
92
+ * @internal The `text-anchor` that keeps a line of this direction where `anchor` puts a line in the plot, which is laid
93
+ * out left to right (chart-parts): a line's `start` is its left in "ltr" and its right in "rtl" (SVG 2's text-anchor:
94
+ * the start of a text chunk is the side its direction starts from; Chromium anchors a tspan by its own direction and
95
+ * text-anchor, checked in Chromium). So "end" (a left-hand axis's ticks, their
96
+ * right edge at the plot) is "start" for a line read from the right, and "start" (a right-hand axis's, a bar-end label
97
+ * running forward) is "end"; "middle" is "middle" either way.
98
+ */
99
+ export function anchorFor(anchor, direction) {
100
+ const ltr = anchor === "end" || anchor === "middle" ? anchor : "start";
101
+ if (direction === "ltr" || ltr === "middle")
102
+ return ltr;
103
+ return ltr === "start" ? "end" : "start";
104
+ }
105
+ /** @internal A line that is not clipped: in its own direction, where Recharts anchors it (`anchor` as the plot's left-to-right text has it). */
106
+ export function placedLine(line, x, anchor) {
107
+ const direction = lineDirection(line);
108
+ return { x, direction, anchor: anchorFor(anchor, direction) };
109
+ }
110
+ /**
111
+ * @internal Where a clipped line is drawn, for a value tick and a bar-end label alike: from one edge
112
+ * of its clip, in that edge's direction, as its own isolated paragraph (`direction`, `unicode-bidi: isolate`, drawn
113
+ * from the text's `start` anchor). The plot is laid out left to right (chart-parts), so a line that starts to read
114
+ * from the right ("\u200f١٥٠ ترليون €xxxx") was drawn with its right-to-left run on the left and its Latin tail on the
115
+ * right: anchored at the clip's right edge, the tail stayed in view and the figure was clipped. The direction is the
116
+ * one in which the line's first character is drawn inside the clip (axis-width's clipDirection): "rtl" from the
117
+ * clip's right edge for that line, "ltr" from its left edge for one that reads from the left, a right-to-left run
118
+ * within it ("€ 1,5 ترليون xxxx") or not, and for a right-to-left mark before a left-to-right figure
119
+ * ("\u200f1.45M €xxxx"). `start` is the clip's left edge, `width` its width.
120
+ */
121
+ export function clippedLine(line, start, width, figures) {
122
+ return clipDirection(line, width, figures) === "rtl" ? { x: start + width, direction: "rtl", anchor: "start" } : { x: start, direction: "ltr", anchor: "start" };
123
+ }
124
+ /**
125
+ * @internal A tick's or label's line: every line, clipped or not, its own isolated paragraph in its own
126
+ * direction (`direction`, `unicode-bidi: isolate`), so it reads as its text does whatever the lines around it hold:
127
+ * "\u200f١٥٠ ترليون €" from the right, its "€" at its end on the left, where the plot's left-to-right paragraph drew
128
+ * its "€" on the right, after "١٥٠", a figure-first reading. Its `text-anchor` is set where its direction needs another
129
+ * than the text's (`inherited`) to stand where the text is anchored ({@link anchorFor}); a line read from the left
130
+ * needs none, so it is drawn exactly as before.
131
+ */
132
+ export function LineSpan({ x, direction, anchor, inherited, dy, children }) {
133
+ return (_jsx("tspan", { x: x, dy: dy, direction: direction, unicodeBidi: "isolate", textAnchor: anchor === anchorFor(inherited, "ltr") ? undefined : anchor, children: children }));
134
+ }
135
+ /** A value tick's font size in px: a line's height, as its lines stand 1em apart. */
136
+ const TICK_FONT = 11;
137
+ /**
138
+ * @internal The style that keeps a tick centered under the plot at `x` inside the chart's edges, 0 and `edge`, by its
139
+ * drawn width, or none where it needs none. The tick stays centered on its gridline and a CSS
140
+ * translation, resolved by the browser against the text's own box (`transform-box: fill-box`, so 50% is half its drawn
141
+ * width), moves it in only by what it passes an edge: `clamp(50% + 0.075em − x, 0, edge − x − 0.075em − 50%)`, 0 for a
142
+ * tick that stands inside them. The box is centered on the gridline but for a glyph's overhang past its advance on one
143
+ * side (at most 0.142em, Arial's "ʃʃ"; 1px for a formatted value, measured in Chromium for Geist, Arial, Noto Sans,
144
+ * DejaVu Sans, Nimbus Sans and the system faces), which shifts the box's center by half that at most: hence 0.075em.
145
+ * So a tick never passes an edge, and one whose box stands more than 0.075em (0.83px at 11px) inside both edges stays
146
+ * on its gridline exactly, whatever the face; one nearer an edge moves in by at most that. Nothing is measured in
147
+ * script: the server and the first render write the same markup. Only where its estimated width (axis-width's
148
+ * textWidth, an upper bound) could reach that margin is the style set, so every other tick is drawn exactly as Recharts
149
+ * drew it. A tick wider than the whole chart (none is: axis-width's tickText keeps its lines within `edge`) would stand
150
+ * at the chart's start.
151
+ */
152
+ export function edgeShift(lines, x, edge, fontSize = TICK_FONT) {
153
+ const half = Math.max(0, ...lines.map((line) => textWidth(line, "tabular"))) / 2 + EDGE_OVERHANG * fontSize;
154
+ if (x - half >= 0 && x + half <= edge)
155
+ return undefined;
156
+ const px = (value) => `${Math.round(value * 1000) / 1000}px`;
157
+ return { transformBox: "fill-box", transform: `translateX(clamp(calc(50% + ${EDGE_OVERHANG}em - ${px(x)}), 0px, calc(${px(edge - x)} - ${EDGE_OVERHANG}em - 50%)))` };
158
+ }
159
+ /** Half the most a glyph's box passes its advance on one side, in em (see edgeShift). */
160
+ const EDGE_OVERHANG = 0.075;
161
+ /**
162
+ * How far a line's box (its glyph cells: what the svg's bottom, an axis name or the legend must clear) reaches below
163
+ * its baseline at most, in em, in any face the charts' text may be drawn in: font-independent, as
164
+ * textWidth is. Measured in Chromium as each face's descent (its line box, wider than its ink): Geist 0.295, Noto Sans
165
+ * 0.293, Nimbus Sans 0.271, Droid Sans Fallback 0.266, DejaVu Sans 0.236, Arial (Liberation Sans) 0.212, and Noto
166
+ * Sans Hebrew, Armenian, Georgian and CJK 0.288–0.292, so 0.3em for those scripts; Noto Sans Arabic 0.738, Noto Naskh
167
+ * Arabic 0.634, Noto Kufi Arabic 0.615, Noto Nastaliq Urdu 0.596, Noto Sans Syriac 0.486 and Thaana 0.424, so 0.74em
168
+ * for a line with an Arabic-family letter; up to 1.03 for any other script (Noto Sans Siddham; Myanmar 0.86, Thai
169
+ * 0.45, Devanagari 0.408), so 1.05em.
170
+ */
171
+ function descentEm(text) {
172
+ if (/[\p{Script=Arabic}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Nko}\p{Script=Hanifi_Rohingya}]/u.test(text))
173
+ return 0.74;
174
+ if (/[^\p{Script=Latin}\p{Script=Greek}\p{Script=Cyrillic}\p{Script=Armenian}\p{Script=Georgian}\p{Script=Hebrew}\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Common}\p{Script=Inherited}]/u.test(text))
175
+ return 1.05;
176
+ return 0.3;
177
+ }
178
+ /**
179
+ * @internal The lines an x band `band` px tall holds for this tick under the plot (the x band): its first
180
+ * line's baseline 0.71em under the 8px inset (firstLineDy "start"), each further line 1em lower, and the last line's
181
+ * box inside the band, so no line passes the svg's bottom, an axis name or the legend below, in any face: its descent
182
+ * the most any face's reaches ({@link descentEm}), rounded up to a whole pixel, as Chromium rounds a face's descent at
183
+ * the scale it draws it (so at any device pixel ratio). At least one. Recharts' default band (30px) holds one line of
184
+ * any script at 11px (two of Latin would need 31px: 8 + 7.81 + 11 + 4).
185
+ */
186
+ export function bandLines(text, band, fontSize = TICK_FONT) {
187
+ const first = TICK_INSET + 0.71 * fontSize;
188
+ const descent = Math.ceil(descentEm(text) * fontSize);
189
+ return Math.max(1, Math.floor((band - first - descent) / fontSize) + 1);
190
+ }
191
+ /**
192
+ * @internal A category axis's tick under the plot (periods, steps), drawn as Recharts draws it, kept inside the chart:
193
+ * Recharts centers a tick on its period, so the last one (on the plot's edge, or in a narrow band)
194
+ * could stand past the chart's edge ("Sep" by 0.7px, a waterfall's "Closing" at 320px). It stays at Recharts' x, on
195
+ * its band's center, and takes the value ticks' CSS clamp ({@link edgeShift})
196
+ * where its estimated width could reach an edge: the browser moves it in by its drawn width only as far
197
+ * as it passes the edge, so a tick that fits stays exactly centered (moved by the estimate, an upper bound, it stood
198
+ * off its band's center) and none passes the edge. Line and area charts also give the last period the room for its
199
+ * half (core-charts' edgeMargin), so theirs never moves.
200
+ */
201
+ export function CategoryTick({ x, y, width, height, payload, index = 0, tickFormatter, textAnchor = "middle", verticalAnchor = "start", fill, stroke, fontSize, style }) {
202
+ const chartWidth = useChartWidth();
203
+ if (x == null || y == null || !payload)
204
+ return null;
205
+ const text = String(typeof tickFormatter === "function" ? tickFormatter(payload.value, index) : payload.value);
206
+ const at = Number(x);
207
+ const shift = textAnchor === "middle" && chartWidth !== undefined && chartWidth > 0 && Number.isFinite(at) ? edgeShift([text], at, chartWidth, Number(fontSize) > 0 ? Number(fontSize) : TICK_FONT) : undefined;
208
+ const line = placedLine(text, x, textAnchor);
209
+ return (_jsx("text", { x: x, y: y, width: width, height: height, stroke: stroke, fill: fill, fontSize: fontSize, style: shift ? { ...style, ...shift } : style, textAnchor: textAnchor, className: "recharts-text recharts-cartesian-axis-tick-value", children: _jsx(LineSpan, { ...line, inherited: textAnchor, dy: firstLineDy(1, verticalAnchor), children: text }) }));
210
+ }
211
+ /**
212
+ * @internal A category name beside the plot (a horizontal BarChart's regions) or around it (a RadarChart's
213
+ * dimensions), drawn by Recharts' own Text as Recharts draws it (its own wrapping, measured), as its own isolated
214
+ * paragraph in the name's reading direction ({@link lineDirection}), anchored where Recharts anchors it
215
+ * ({@link anchorFor}): a name read from the right reads so, its marks and figures where it writes them,
216
+ * in the left-to-right plot. Its lines are the one name's, in the name's direction. `polar` for a RadarChart's, which
217
+ * Recharts classes as its angle axis's.
218
+ */
219
+ export function NameTick({ payload, index = 0, tickFormatter, textAnchor = "middle", polar = false, ...props }) {
220
+ if (!payload)
221
+ return null;
222
+ const text = String(typeof tickFormatter === "function" ? tickFormatter(payload.value, index) : payload.value);
223
+ const direction = lineDirection(text);
224
+ const className = typeof props.className === "string" ? props.className : polar ? "recharts-polar-angle-axis-tick-value" : "recharts-cartesian-axis-tick-value";
225
+ return (_jsx(Text, { ...props, className: className, direction: direction, unicodeBidi: "isolate", textAnchor: anchorFor(textAnchor, direction), children: text }));
226
+ }
227
+ /** Where Recharts anchors a cartesian label at these positions (its getCartesianPosition, for a box of positive width). */
228
+ const LABEL_ANCHOR = { top: "middle", insideBottom: "middle", insideLeft: "start", insideBottomLeft: "start", insideRight: "end", insideBottomRight: "end" };
229
+ /**
230
+ * @internal The props that give a Recharts label (a ScatterChart's axis name, a reference line's label) its own isolated
231
+ * direction, as {@link NameTick} gives a name: `direction` from its text ({@link lineDirection}),
232
+ * `unicode-bidi: isolate`, and the `text-anchor` that keeps it where Recharts puts a label at `position` in the
233
+ * left-to-right plot ({@link anchorFor}; Recharts takes a label's own `textAnchor` over the position's). A label read
234
+ * from the left keeps the position's anchor, so it is drawn as before. Spread into the label's props.
235
+ */
236
+ export function isolatedLabel(text, position) {
237
+ const direction = lineDirection(text ?? "");
238
+ return { direction, unicodeBidi: "isolate", textAnchor: anchorFor(LABEL_ANCHOR[position], direction) };
239
+ }
240
+ //# sourceMappingURL=value-tick.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"value-tick.js","sourceRoot":"","sources":["../../src/charts/value-tick.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,eAAe,EAAE,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE9H;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa,EAAE,SAAqC,QAAQ;IACtF,MAAM,EAAE,GAAG,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;IACjG,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC;AAC7C,CAAC;AAyBD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,SAAS,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,GAAG,CAAC,EAAE,aAAa,EAAE,UAAU,EAAE,cAAc,GAAG,QAAQ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sC,CAAC,CAAC,CAAC,oCAAoC,CAAC;IAChK,OAAO,CACL,KAAC,IAAI,OAAM,KAA2C,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAC,SAAS,EAAC,UAAU,EAAE,SAAS,CAAC,UAAU,EAAE,SAAS,CAAC,YACnK,IAAI,GACA,CACR,CAAC;AACJ,CAAC;AAED,2HAA2H;AAC3H,MAAM,YAAY,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAW,CAAC;AAEtK;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,IAAwB,EAAE,QAAmC;IACzF,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;IAC5C,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,EAAE,CAAC;AACzG,CAAC","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { useLocale } from \"react-aria-components\";\nimport { Text, useChartWidth } from \"recharts\";\n\nimport { TICK_INSET, chartNumber, clipDirection, formattedValues, readsRightToLeft, textWidth, tickText } from \"./axis-width\";\n\n/**\n * @internal The dy of a label's first line, as Recharts' Text sets it: lines stacked from the anchor (`start`, an\n * x-axis tick under the axis), centered on it (`middle`, a y-axis tick, a bar-end label), or ending at it, plus\n * the cap height (0.71em) that puts the text's middle, top or baseline there. Shared by the value ticks and the\n * bar-end labels, so both sit exactly where Recharts drew them.\n */\nexport function firstLineDy(lines: number, anchor: \"start\" | \"middle\" | \"end\" = \"middle\"): string {\n const em = anchor === \"start\" ? 0.71 : anchor === \"middle\" ? (1 - lines) / 2 + 0.355 : 1 - lines;\n return `${Math.round(em * 1000) / 1000}em`;\n}\n\n/** What Recharts hands a custom tick (CartesianAxis), and what the chart sets on it. */\nexport type ValueTickProps = {\n x?: number | string;\n y?: number | string;\n /** The room the tick has: the axis's, or the chart's own (axis-width's tickWrapWidth). */\n width?: number | string;\n height?: number | string;\n payload?: { value?: unknown };\n index?: number;\n tickFormatter?: (value: never, index: number) => React.ReactNode;\n textAnchor?: \"start\" | \"middle\" | \"end\" | \"inherit\";\n verticalAnchor?: \"start\" | \"middle\" | \"end\";\n fill?: string;\n stroke?: string;\n fontSize?: number | string;\n style?: React.CSSProperties;\n /**\n * The values of every tick the axis draws, as the chart predicts them (axis-width's valueAxisTicks, as it sizes\n * the axis): when one of them needs a compact figure, every tick of the axis shows one.\n */\n axisTicks?: readonly number[];\n};\n\n/**\n * @internal A value axis's tick, in place of Recharts' own Text, which wrapped a tick at any space\n * once it passed its room: at the 128px clamp \"€ 150.000.000.000.000\" stood as \"€\" over \"150.000.000.000.000\",\n * the figure running past the axis's edge. This one lays the tick out by the bar-end labels' rule (axis-width's\n * textUnits: a currency, a sign and a figure are one unit) and, when a unit does not fit, shows the axis's figures\n * compact and exact in the chart's locale (`tickText`), with the whole tick as the text's accessible name and hover\n * title. Pure: it measures nothing, so the server, the first render and every later one draw the same. Drawn as\n * Recharts draws a tick (a `recharts-cartesian-axis-tick-value` text with a tspan a line), so a tick that fits is\n * where and as it was; only the orientation attribute Recharts' Text passed through is not set.\n *\n * On a vertical axis, a line still wider than the room, by the estimate (a formatter's long word against a figure,\n * which no shortening may cut), is clipped to the room: the room runs from where Recharts anchors the tick, beside the\n * plot, to the axis's outer edge, so a clipped tick never stands over the plot nor past the chart's edge. Each line is\n * drawn from the room's edge where it starts to read ({@link clippedLine}), so its reading start, the currency and\n * figure a formatter writes first, stays in view, and the tick carries the whole tick as its accessible name and\n * hover title, as a shortened one does. Under the plot (a horizontal axis) nothing clips a tick, so it is at most\n * compact (axis-width's tickText): never in scientific notation nor shortened with \"…\".\n *\n * Every line, clipped or not, is drawn in its own reading direction, isolated ({@link LineSpan}), where Recharts\n * anchors it: \"\\u200f١٥٠ ترليون €\" reads from the right with its \"€\" at its end, on the left, in the left-to-right plot.\n */\nexport function ValueTick({ x, y, width, height, payload, index = 0, tickFormatter, textAnchor, verticalAnchor = \"middle\", fill, stroke, fontSize, style, axisTicks }: ValueTickProps) {\n const { locale } = useLocale();\n const chartWidth = useChartWidth();\n const clipId = `ds-value-tick-${React.useId().replace(/[^\\w-]/g, \"\")}`;\n if (x == null || y == null || !payload) return null;\n const format = (value: unknown, at: number) => String(typeof tickFormatter === \"function\" ? tickFormatter(value as never, at) : value);\n const full = format(payload.value, index);\n const room = width == null || width === \"\" || !Number.isFinite(Number(width)) ? Number.POSITIVE_INFINITY : Number(width);\n // The values the axis's ticks were formatted from, as the chart sized the axis from them: what proves how the\n // formatter writes its marks (axis-width's markRoles).\n const values = new Map(formattedValues(axisTicks ?? [], (value) => format(value, 0)));\n const own = chartNumber(payload.value);\n if (own !== undefined) values.set(full, own);\n // Only beside the plot (a vertical axis, anchored at its start or end) is a tick clipped: under the plot a tick's room\n // is the whole axis, not a band of its own, and only the chart's edge bounds it (it moves in from the edges, below),\n // so a tick there is at most compact, never scientific, never \"…\", unless it is wider than the whole chart.\n const beside = textAnchor === \"start\" || textAnchor === \"end\";\n // Under the plot the band Recharts gives the axis (its height, 30px by default) holds its lines under the 8px inset:\n // a tick that would take more is laid out wider in no more, never past the svg's bottom nor into an axis name or\n // the legend below (axis-width's linesWithin; bandLines).\n const band = Number(height);\n const maxLines = beside || !(band > 0) ? Number.POSITIVE_INFINITY : bandLines(full, band, Number(fontSize) > 0 ? Number(fontSize) : TICK_FONT);\n const edge = beside || chartWidth === undefined || !(chartWidth > 0) ? undefined : chartWidth;\n const { lines, shortened } = tickText(full, room, locale, axisTicks?.map((value) => format(value, 0)), values, beside, maxLines, edge);\n const clipped = beside && Number.isFinite(room) && Number.isFinite(Number(x)) && lines.some((line) => textWidth(line, \"tabular\") > room);\n // The room along the line: Recharts anchors a tick at the plot's side of it (its end on a left-hand axis, its start\n // on a right-hand one).\n const anchorX = Number(x);\n const roomStart = textAnchor === \"end\" ? anchorX - room : anchorX;\n const anchor = clipped ? \"start\" : textAnchor;\n // Under the plot, centered on its value, a tick moves in from the chart's edges just far enough to stand inside them\n // (a tick wider than its room passed the chart's edge, which Recharts' spacing, measured on other text,\n // did not prevent), by its drawn width, not the estimate (moved by the estimate, an upper bound, a\n // tick that fit stood 2–14px off its gridline): see edgeShift.\n const shift = textAnchor === \"middle\" && edge !== undefined && Number.isFinite(anchorX) ? edgeShift(lines, anchorX, edge, Number(fontSize) > 0 ? Number(fontSize) : TICK_FONT) : undefined;\n const lineAt = (line: string): PlacedLine => (clipped ? clippedLine(line, roomStart, room, \"tabular\") : placedLine(line, x, textAnchor));\n const drawX = lineAt(lines[0] ?? \"\").x;\n const named = shortened || clipped;\n const lineBox = (lines.length + 1) * TICK_FONT;\n return (\n <>\n {clipped && (\n <clipPath id={clipId}>\n <rect x={roomStart} y={Number(y) - lineBox} width={room} height={lineBox * 2} />\n </clipPath>\n )}\n <text\n x={drawX}\n y={y}\n width={width}\n height={height}\n stroke={stroke}\n fill={fill}\n fontSize={fontSize}\n style={shift ? { ...style, ...shift } : style}\n textAnchor={anchor}\n // Recharts' own tick's classes (its Text takes no axis classes), so a tick looks and is found as before.\n className=\"recharts-text recharts-cartesian-axis-tick-value\"\n data-slot=\"chart-value-tick\"\n data-shortened={shortened || undefined}\n data-clipped={clipped || undefined}\n clipPath={clipped ? `url(#${clipId})` : undefined}\n aria-label={named ? full : undefined}\n >\n {named && <title>{full}</title>}\n {lines.map((line, at) => (\n <LineSpan key={at} {...lineAt(line)} inherited={anchor} dy={at === 0 ? firstLineDy(lines.length, verticalAnchor) : \"1em\"}>\n {line}\n </LineSpan>\n ))}\n </text>\n </>\n );\n}\n\ntype Direction = \"ltr\" | \"rtl\";\ntype Anchor = \"start\" | \"middle\" | \"end\";\n\n/**\n * @internal A line as it is drawn: at `x`, in its own `direction`, with the `text-anchor` that, in that direction, puts\n * it where the chart anchors it. `x` as Recharts gives it (a number, or a string it passes through).\n */\nexport type PlacedLine = { x: number | string | undefined; direction: Direction; anchor: Anchor };\n\n/**\n * @internal The direction a tick's or label's line reads in, from its own text (axis-width's readsRightToLeft: its\n * first letter, figure or direction mark): \"rtl\" for \"\\u200f١٥٠ ترليون €\", \"‏1.5E14 €\", \"١٥٠ ترليون\"; \"ltr\" for\n * \"€ 1.450.000\", \"€ 1,5 ترليون\", \"12 млн km / h\".\n */\nexport function lineDirection(line: string): Direction {\n return readsRightToLeft(line) ? \"rtl\" : \"ltr\";\n}\n\n/**\n * @internal The `text-anchor` that keeps a line of this direction where `anchor` puts a line in the plot, which is laid\n * out left to right (chart-parts): a line's `start` is its left in \"ltr\" and its right in \"rtl\" (SVG 2's text-anchor:\n * the start of a text chunk is the side its direction starts from; Chromium anchors a tspan by its own direction and\n * text-anchor, checked in Chromium). So \"end\" (a left-hand axis's ticks, their\n * right edge at the plot) is \"start\" for a line read from the right, and \"start\" (a right-hand axis's, a bar-end label\n * running forward) is \"end\"; \"middle\" is \"middle\" either way.\n */\nexport function anchorFor(anchor: Anchor | \"inherit\" | undefined, direction: Direction): Anchor {\n const ltr = anchor === \"end\" || anchor === \"middle\" ? anchor : \"start\";\n if (direction === \"ltr\" || ltr === \"middle\") return ltr;\n return ltr === \"start\" ? \"end\" : \"start\";\n}\n\n/** @internal A line that is not clipped: in its own direction, where Recharts anchors it (`anchor` as the plot's left-to-right text has it). */\nexport function placedLine(line: string, x: number | string | undefined, anchor: Anchor | \"inherit\" | undefined): PlacedLine {\n const direction = lineDirection(line);\n return { x, direction, anchor: anchorFor(anchor, direction) };\n}\n\n/**\n * @internal Where a clipped line is drawn, for a value tick and a bar-end label alike: from one edge\n * of its clip, in that edge's direction, as its own isolated paragraph (`direction`, `unicode-bidi: isolate`, drawn\n * from the text's `start` anchor). The plot is laid out left to right (chart-parts), so a line that starts to read\n * from the right (\"\\u200f١٥٠ ترليون €xxxx\") was drawn with its right-to-left run on the left and its Latin tail on the\n * right: anchored at the clip's right edge, the tail stayed in view and the figure was clipped. The direction is the\n * one in which the line's first character is drawn inside the clip (axis-width's clipDirection): \"rtl\" from the\n * clip's right edge for that line, \"ltr\" from its left edge for one that reads from the left, a right-to-left run\n * within it (\"€ 1,5 ترليون xxxx\") or not, and for a right-to-left mark before a left-to-right figure\n * (\"\\u200f1.45M €xxxx\"). `start` is the clip's left edge, `width` its width.\n */\nexport function clippedLine(line: string, start: number, width: number, figures: \"proportional\" | \"tabular\"): PlacedLine {\n return clipDirection(line, width, figures) === \"rtl\" ? { x: start + width, direction: \"rtl\", anchor: \"start\" } : { x: start, direction: \"ltr\", anchor: \"start\" };\n}\n\n/**\n * @internal A tick's or label's line: every line, clipped or not, its own isolated paragraph in its own\n * direction (`direction`, `unicode-bidi: isolate`), so it reads as its text does whatever the lines around it hold:\n * \"\\u200f١٥٠ ترليون €\" from the right, its \"€\" at its end on the left, where the plot's left-to-right paragraph drew\n * its \"€\" on the right, after \"١٥٠\", a figure-first reading. Its `text-anchor` is set where its direction needs another\n * than the text's (`inherited`) to stand where the text is anchored ({@link anchorFor}); a line read from the left\n * needs none, so it is drawn exactly as before.\n */\nexport function LineSpan({ x, direction, anchor, inherited, dy, children }: PlacedLine & { inherited: Anchor | \"inherit\" | undefined; dy: string; children: string }) {\n return (\n <tspan x={x} dy={dy} direction={direction} unicodeBidi=\"isolate\" textAnchor={anchor === anchorFor(inherited, \"ltr\") ? undefined : anchor}>\n {children}\n </tspan>\n );\n}\n\n/** A value tick's font size in px: a line's height, as its lines stand 1em apart. */\nconst TICK_FONT = 11;\n\n/**\n * @internal The style that keeps a tick centered under the plot at `x` inside the chart's edges, 0 and `edge`, by its\n * drawn width, or none where it needs none. The tick stays centered on its gridline and a CSS\n * translation, resolved by the browser against the text's own box (`transform-box: fill-box`, so 50% is half its drawn\n * width), moves it in only by what it passes an edge: `clamp(50% + 0.075em − x, 0, edge − x − 0.075em − 50%)`, 0 for a\n * tick that stands inside them. The box is centered on the gridline but for a glyph's overhang past its advance on one\n * side (at most 0.142em, Arial's \"ʃʃ\"; 1px for a formatted value, measured in Chromium for Geist, Arial, Noto Sans,\n * DejaVu Sans, Nimbus Sans and the system faces), which shifts the box's center by half that at most: hence 0.075em.\n * So a tick never passes an edge, and one whose box stands more than 0.075em (0.83px at 11px) inside both edges stays\n * on its gridline exactly, whatever the face; one nearer an edge moves in by at most that. Nothing is measured in\n * script: the server and the first render write the same markup. Only where its estimated width (axis-width's\n * textWidth, an upper bound) could reach that margin is the style set, so every other tick is drawn exactly as Recharts\n * drew it. A tick wider than the whole chart (none is: axis-width's tickText keeps its lines within `edge`) would stand\n * at the chart's start.\n */\nexport function edgeShift(lines: readonly string[], x: number, edge: number, fontSize: number = TICK_FONT): React.CSSProperties | undefined {\n const half = Math.max(0, ...lines.map((line) => textWidth(line, \"tabular\"))) / 2 + EDGE_OVERHANG * fontSize;\n if (x - half >= 0 && x + half <= edge) return undefined;\n const px = (value: number) => `${Math.round(value * 1000) / 1000}px`;\n return { transformBox: \"fill-box\", transform: `translateX(clamp(calc(50% + ${EDGE_OVERHANG}em - ${px(x)}), 0px, calc(${px(edge - x)} - ${EDGE_OVERHANG}em - 50%)))` };\n}\n\n/** Half the most a glyph's box passes its advance on one side, in em (see edgeShift). */\nconst EDGE_OVERHANG = 0.075;\n\n/**\n * How far a line's box (its glyph cells: what the svg's bottom, an axis name or the legend must clear) reaches below\n * its baseline at most, in em, in any face the charts' text may be drawn in: font-independent, as\n * textWidth is. Measured in Chromium as each face's descent (its line box, wider than its ink): Geist 0.295, Noto Sans\n * 0.293, Nimbus Sans 0.271, Droid Sans Fallback 0.266, DejaVu Sans 0.236, Arial (Liberation Sans) 0.212, and Noto\n * Sans Hebrew, Armenian, Georgian and CJK 0.288–0.292, so 0.3em for those scripts; Noto Sans Arabic 0.738, Noto Naskh\n * Arabic 0.634, Noto Kufi Arabic 0.615, Noto Nastaliq Urdu 0.596, Noto Sans Syriac 0.486 and Thaana 0.424, so 0.74em\n * for a line with an Arabic-family letter; up to 1.03 for any other script (Noto Sans Siddham; Myanmar 0.86, Thai\n * 0.45, Devanagari 0.408), so 1.05em.\n */\nfunction descentEm(text: string): number {\n if (/[\\p{Script=Arabic}\\p{Script=Syriac}\\p{Script=Thaana}\\p{Script=Nko}\\p{Script=Hanifi_Rohingya}]/u.test(text)) return 0.74;\n if (/[^\\p{Script=Latin}\\p{Script=Greek}\\p{Script=Cyrillic}\\p{Script=Armenian}\\p{Script=Georgian}\\p{Script=Hebrew}\\p{Script=Han}\\p{Script=Hiragana}\\p{Script=Katakana}\\p{Script=Hangul}\\p{Script=Common}\\p{Script=Inherited}]/u.test(text)) return 1.05;\n return 0.3;\n}\n\n/**\n * @internal The lines an x band `band` px tall holds for this tick under the plot (the x band): its first\n * line's baseline 0.71em under the 8px inset (firstLineDy \"start\"), each further line 1em lower, and the last line's\n * box inside the band, so no line passes the svg's bottom, an axis name or the legend below, in any face: its descent\n * the most any face's reaches ({@link descentEm}), rounded up to a whole pixel, as Chromium rounds a face's descent at\n * the scale it draws it (so at any device pixel ratio). At least one. Recharts' default band (30px) holds one line of\n * any script at 11px (two of Latin would need 31px: 8 + 7.81 + 11 + 4).\n */\nexport function bandLines(text: string, band: number, fontSize: number = TICK_FONT): number {\n const first = TICK_INSET + 0.71 * fontSize;\n const descent = Math.ceil(descentEm(text) * fontSize);\n return Math.max(1, Math.floor((band - first - descent) / fontSize) + 1);\n}\n\n/**\n * @internal A category axis's tick under the plot (periods, steps), drawn as Recharts draws it, kept inside the chart:\n * Recharts centers a tick on its period, so the last one (on the plot's edge, or in a narrow band)\n * could stand past the chart's edge (\"Sep\" by 0.7px, a waterfall's \"Closing\" at 320px). It stays at Recharts' x, on\n * its band's center, and takes the value ticks' CSS clamp ({@link edgeShift})\n * where its estimated width could reach an edge: the browser moves it in by its drawn width only as far\n * as it passes the edge, so a tick that fits stays exactly centered (moved by the estimate, an upper bound, it stood\n * off its band's center) and none passes the edge. Line and area charts also give the last period the room for its\n * half (core-charts' edgeMargin), so theirs never moves.\n */\nexport function CategoryTick({ x, y, width, height, payload, index = 0, tickFormatter, textAnchor = \"middle\", verticalAnchor = \"start\", fill, stroke, fontSize, style }: ValueTickProps) {\n const chartWidth = useChartWidth();\n if (x == null || y == null || !payload) return null;\n const text = String(typeof tickFormatter === \"function\" ? tickFormatter(payload.value as never, index) : payload.value);\n const at = Number(x);\n const shift = textAnchor === \"middle\" && chartWidth !== undefined && chartWidth > 0 && Number.isFinite(at) ? edgeShift([text], at, chartWidth, Number(fontSize) > 0 ? Number(fontSize) : TICK_FONT) : undefined;\n const line = placedLine(text, x, textAnchor);\n return (\n <text\n x={x}\n y={y}\n width={width}\n height={height}\n stroke={stroke}\n fill={fill}\n fontSize={fontSize}\n style={shift ? { ...style, ...shift } : style}\n textAnchor={textAnchor}\n className=\"recharts-text recharts-cartesian-axis-tick-value\"\n >\n <LineSpan {...line} inherited={textAnchor} dy={firstLineDy(1, verticalAnchor)}>\n {text}\n </LineSpan>\n </text>\n );\n}\n\n/**\n * @internal A category name beside the plot (a horizontal BarChart's regions) or around it (a RadarChart's\n * dimensions), drawn by Recharts' own Text as Recharts draws it (its own wrapping, measured), as its own isolated\n * paragraph in the name's reading direction ({@link lineDirection}), anchored where Recharts anchors it\n * ({@link anchorFor}): a name read from the right reads so, its marks and figures where it writes them,\n * in the left-to-right plot. Its lines are the one name's, in the name's direction. `polar` for a RadarChart's, which\n * Recharts classes as its angle axis's.\n */\nexport function NameTick({ payload, index = 0, tickFormatter, textAnchor = \"middle\", polar = false, ...props }: ValueTickProps & { className?: string; polar?: boolean; [prop: string]: unknown }) {\n if (!payload) return null;\n const text = String(typeof tickFormatter === \"function\" ? tickFormatter(payload.value as never, index) : payload.value);\n const direction = lineDirection(text);\n const className = typeof props.className === \"string\" ? props.className : polar ? \"recharts-polar-angle-axis-tick-value\" : \"recharts-cartesian-axis-tick-value\";\n return (\n <Text {...(props as React.ComponentProps<typeof Text>)} className={className} direction={direction} unicodeBidi=\"isolate\" textAnchor={anchorFor(textAnchor, direction)}>\n {text}\n </Text>\n );\n}\n\n/** Where Recharts anchors a cartesian label at these positions (its getCartesianPosition, for a box of positive width). */\nconst LABEL_ANCHOR = { top: \"middle\", insideBottom: \"middle\", insideLeft: \"start\", insideBottomLeft: \"start\", insideRight: \"end\", insideBottomRight: \"end\" } as const;\n\n/**\n * @internal The props that give a Recharts label (a ScatterChart's axis name, a reference line's label) its own isolated\n * direction, as {@link NameTick} gives a name: `direction` from its text ({@link lineDirection}),\n * `unicode-bidi: isolate`, and the `text-anchor` that keeps it where Recharts puts a label at `position` in the\n * left-to-right plot ({@link anchorFor}; Recharts takes a label's own `textAnchor` over the position's). A label read\n * from the left keeps the position's anchor, so it is drawn as before. Spread into the label's props.\n */\nexport function isolatedLabel(text: string | undefined, position: keyof typeof LABEL_ANCHOR): { direction: Direction; unicodeBidi: \"isolate\"; textAnchor: Anchor } {\n const direction = lineDirection(text ?? \"\");\n return { direction, unicodeBidi: \"isolate\", textAnchor: anchorFor(LABEL_ANCHOR[position], direction) };\n}\n"]}
@@ -0,0 +1,34 @@
1
+ import type { SortDescriptor } from "react-aria-components";
2
+ import { type DataTableView } from "./data-table-url.js";
3
+ export type DataTableUrlFilter = {
4
+ key: string;
5
+ options: readonly {
6
+ id: string;
7
+ }[];
8
+ };
9
+ export type UseDataTableUrlOptions = {
10
+ /** The table's `filters`: only their keys are read from the URL, and only values they offer. */
11
+ filters?: readonly DataTableUrlFilter[];
12
+ /** The table's `defaultSort`, left out of the URL. */
13
+ defaultSort?: SortDescriptor;
14
+ /** Prefixes the URL params (`orders.page`) when two tables share a page. */
15
+ urlKey?: string;
16
+ /**
17
+ * The URL's search params. Pass them when the page renders on the server (SSR): without them the server
18
+ * reads no params while the browser reads `window.location.search`, and a URL with params hydrates with a
19
+ * mismatch. A host router can also pass its current params here; the view follows when they change.
20
+ */
21
+ searchParams?: URLSearchParams | string;
22
+ /** Passed to the provider's `navigate` with each view change (a host router's replace or scroll option). */
23
+ routerOptions?: unknown;
24
+ };
25
+ /**
26
+ * Keeps a DataTable's view in the URL, so a reload or a shared link shows the same page, sort, filters and search:
27
+ * `<DataTable {...useDataTableUrl({ filters, defaultSort })} … />`. Reads the URL on mount, writes every change through
28
+ * the provider's `navigate`, and follows Back and Forward and a host router's new `searchParams`. The format is
29
+ * flat and readable (`?q=acme&status=active&sort=name&dir=desc&page=2`); defaults are left out.
30
+ */
31
+ export declare function useDataTableUrl({ filters, defaultSort, urlKey, searchParams, routerOptions }?: UseDataTableUrlOptions): {
32
+ view: DataTableView;
33
+ onViewChange: (view: DataTableView) => void;
34
+ };
@@ -0,0 +1,70 @@
1
+ "use client";
2
+ import * as React from "react";
3
+ import { useDesignSystemNavigate } from "../navigate-context.js";
4
+ import { readView, writeView } from "./data-table-url.js";
5
+ const NO_FILTERS = [];
6
+ function initialParams(searchParams) {
7
+ if (searchParams !== undefined)
8
+ return new URLSearchParams(searchParams);
9
+ return new URLSearchParams(typeof window === "undefined" ? "" : window.location.search);
10
+ }
11
+ /**
12
+ * Keeps a DataTable's view in the URL, so a reload or a shared link shows the same page, sort, filters and search:
13
+ * `<DataTable {...useDataTableUrl({ filters, defaultSort })} … />`. Reads the URL on mount, writes every change through
14
+ * the provider's `navigate`, and follows Back and Forward and a host router's new `searchParams`. The format is
15
+ * flat and readable (`?q=acme&status=active&sort=name&dir=desc&page=2`); defaults are left out.
16
+ */
17
+ export function useDataTableUrl({ filters = NO_FILTERS, defaultSort, urlKey, searchParams, routerOptions } = {}) {
18
+ const navigate = useDesignSystemNavigate();
19
+ const filterKeys = React.useMemo(() => filters.map((filter) => filter.key), [filters]);
20
+ const urlOptions = { urlKey, filterKeys, defaultSort };
21
+ // A view from a URL, keeping only filter values the table offers (a stale or hand-edited `?status=foo` is ignored).
22
+ const viewFrom = (params) => {
23
+ const read = readView(params, urlOptions);
24
+ const known = Object.fromEntries(filters
25
+ .map((filter) => [filter.key, (read.filters[filter.key] ?? []).filter((value) => filter.options.some((option) => option.id === value))])
26
+ .filter(([, values]) => values.length > 0));
27
+ return { ...read, filters: known };
28
+ };
29
+ const [view, setView] = React.useState(() => viewFrom(initialParams(searchParams)));
30
+ const viewRef = React.useRef(view);
31
+ viewRef.current = view;
32
+ const onViewChange = (next) => {
33
+ viewRef.current = next;
34
+ setView(next);
35
+ if (!navigate || typeof window === "undefined")
36
+ return;
37
+ const params = writeView(new URLSearchParams(window.location.search), next, urlOptions).toString();
38
+ const href = `${window.location.pathname}${params ? `?${params}` : ""}${window.location.hash}`;
39
+ if (href !== `${window.location.pathname}${window.location.search}${window.location.hash}`)
40
+ navigate(href, routerOptions);
41
+ };
42
+ // The URL moved under the table: Back and Forward, or a host router handing new `searchParams`.
43
+ const adopt = (next) => {
44
+ if (JSON.stringify(next) === JSON.stringify(viewRef.current))
45
+ return;
46
+ viewRef.current = next;
47
+ setView(next);
48
+ };
49
+ const adoptRef = React.useRef(adopt);
50
+ adoptRef.current = adopt;
51
+ const viewFromRef = React.useRef(viewFrom);
52
+ viewFromRef.current = viewFrom;
53
+ React.useEffect(() => {
54
+ if (typeof window === "undefined")
55
+ return;
56
+ const onPop = () => adoptRef.current(viewFromRef.current(new URLSearchParams(window.location.search)));
57
+ window.addEventListener("popstate", onPop);
58
+ return () => window.removeEventListener("popstate", onPop);
59
+ }, []);
60
+ const paramsKey = searchParams === undefined ? undefined : new URLSearchParams(searchParams).toString();
61
+ const firstParams = React.useRef(paramsKey);
62
+ React.useEffect(() => {
63
+ if (paramsKey === undefined || paramsKey === firstParams.current)
64
+ return;
65
+ firstParams.current = paramsKey;
66
+ adoptRef.current(viewFromRef.current(new URLSearchParams(paramsKey)));
67
+ }, [paramsKey]);
68
+ return { view, onViewChange };
69
+ }
70
+ //# sourceMappingURL=data-table-url-hook.js.map