@gild-ui/react 0.0.0 → 0.1.0-alpha.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 (406) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +399 -1
  3. package/dist/Accordion.cjs +338 -0
  4. package/dist/Accordion.d.cts +110 -0
  5. package/dist/Accordion.d.mts +110 -0
  6. package/dist/Accordion.mjs +334 -0
  7. package/dist/Accordion.types-D06ViRMj.d.mts +1114 -0
  8. package/dist/Alert.cjs +187 -0
  9. package/dist/Alert.d.cts +51 -0
  10. package/dist/Alert.d.mts +51 -0
  11. package/dist/Alert.mjs +186 -0
  12. package/dist/AppBar.cjs +76 -0
  13. package/dist/AppBar.d.cts +22 -0
  14. package/dist/AppBar.d.mts +22 -0
  15. package/dist/AppBar.mjs +76 -0
  16. package/dist/Autocomplete.cjs +685 -0
  17. package/dist/Autocomplete.d.cts +97 -0
  18. package/dist/Autocomplete.d.mts +97 -0
  19. package/dist/Autocomplete.mjs +685 -0
  20. package/dist/Avatar.cjs +113 -0
  21. package/dist/Avatar.d.cts +27 -0
  22. package/dist/Avatar.d.mts +27 -0
  23. package/dist/Avatar.mjs +113 -0
  24. package/dist/Backdrop.cjs +30 -0
  25. package/dist/Backdrop.d.cts +11 -0
  26. package/dist/Backdrop.d.mts +11 -0
  27. package/dist/Backdrop.mjs +29 -0
  28. package/dist/Badge.cjs +136 -0
  29. package/dist/Badge.d.cts +47 -0
  30. package/dist/Badge.d.mts +47 -0
  31. package/dist/Badge.mjs +136 -0
  32. package/dist/Breadcrumbs.cjs +150 -0
  33. package/dist/Breadcrumbs.d.cts +33 -0
  34. package/dist/Breadcrumbs.d.mts +33 -0
  35. package/dist/Breadcrumbs.mjs +149 -0
  36. package/dist/Button.cjs +194 -0
  37. package/dist/Button.d.cts +51 -0
  38. package/dist/Button.d.mts +3 -0
  39. package/dist/Button.mjs +194 -0
  40. package/dist/ButtonGroup.cjs +116 -0
  41. package/dist/ButtonGroup.d.cts +43 -0
  42. package/dist/ButtonGroup.d.mts +3 -0
  43. package/dist/ButtonGroup.mjs +115 -0
  44. package/dist/ButtonGroupContext-D5Fg5Slq.mjs +5 -0
  45. package/dist/ButtonGroupContext-W4VkHwoR.cjs +9 -0
  46. package/dist/CacheProvider.cjs +9 -0
  47. package/dist/CacheProvider.d.cts +4 -0
  48. package/dist/CacheProvider.d.mts +4 -0
  49. package/dist/CacheProvider.mjs +9 -0
  50. package/dist/Card.cjs +105 -0
  51. package/dist/Card.d.cts +19 -0
  52. package/dist/Card.d.mts +19 -0
  53. package/dist/Card.mjs +105 -0
  54. package/dist/Checkbox.cjs +210 -0
  55. package/dist/Checkbox.d.cts +48 -0
  56. package/dist/Checkbox.d.mts +48 -0
  57. package/dist/Checkbox.mjs +210 -0
  58. package/dist/Chip.cjs +210 -0
  59. package/dist/Chip.d.cts +51 -0
  60. package/dist/Chip.d.mts +51 -0
  61. package/dist/Chip.mjs +210 -0
  62. package/dist/CircularProgress.cjs +151 -0
  63. package/dist/CircularProgress.d.cts +37 -0
  64. package/dist/CircularProgress.d.mts +37 -0
  65. package/dist/CircularProgress.mjs +151 -0
  66. package/dist/Collapse.cjs +133 -0
  67. package/dist/Collapse.d.cts +38 -0
  68. package/dist/Collapse.d.mts +3 -0
  69. package/dist/Collapse.mjs +133 -0
  70. package/dist/Drawer.cjs +168 -0
  71. package/dist/Drawer.d.cts +60 -0
  72. package/dist/Drawer.d.mts +60 -0
  73. package/dist/Drawer.mjs +166 -0
  74. package/dist/Fab.cjs +123 -0
  75. package/dist/Fab.d.cts +33 -0
  76. package/dist/Fab.d.mts +3 -0
  77. package/dist/Fab.mjs +122 -0
  78. package/dist/FabMenu.cjs +312 -0
  79. package/dist/FabMenu.d.cts +70 -0
  80. package/dist/FabMenu.d.mts +70 -0
  81. package/dist/FabMenu.mjs +311 -0
  82. package/dist/Fade.cjs +17 -0
  83. package/dist/Fade.d.cts +8 -0
  84. package/dist/Fade.d.mts +8 -0
  85. package/dist/Fade.mjs +16 -0
  86. package/dist/Flex.cjs +18 -0
  87. package/dist/Flex.d.cts +2 -0
  88. package/dist/Flex.d.mts +2 -0
  89. package/dist/Flex.mjs +18 -0
  90. package/dist/FocusTrap.cjs +87 -0
  91. package/dist/FocusTrap.d.cts +28 -0
  92. package/dist/FocusTrap.d.mts +28 -0
  93. package/dist/FocusTrap.mjs +86 -0
  94. package/dist/Form.cjs +47 -0
  95. package/dist/Form.d.cts +41 -0
  96. package/dist/Form.d.mts +41 -0
  97. package/dist/Form.mjs +46 -0
  98. package/dist/FormContext-DfpxiqRO.cjs +9 -0
  99. package/dist/FormContext-fZHQHKUU.mjs +6 -0
  100. package/dist/FormControl.cjs +98 -0
  101. package/dist/FormControl.d.cts +81 -0
  102. package/dist/FormControl.d.mts +81 -0
  103. package/dist/FormControl.mjs +96 -0
  104. package/dist/FormControlContext-Btvm04Sj.cjs +9 -0
  105. package/dist/FormControlContext-CaQLS_sK.mjs +6 -0
  106. package/dist/FormHelperText.cjs +40 -0
  107. package/dist/FormHelperText.d.cts +15 -0
  108. package/dist/FormHelperText.d.mts +15 -0
  109. package/dist/FormHelperText.mjs +39 -0
  110. package/dist/FormLabel.cjs +45 -0
  111. package/dist/FormLabel.d.cts +17 -0
  112. package/dist/FormLabel.d.mts +17 -0
  113. package/dist/FormLabel.mjs +44 -0
  114. package/dist/Global.cjs +8 -0
  115. package/dist/Global.d.cts +2 -0
  116. package/dist/Global.d.mts +2 -0
  117. package/dist/Global.mjs +1 -0
  118. package/dist/Grid.cjs +20 -0
  119. package/dist/Grid.d.cts +25 -0
  120. package/dist/Grid.d.mts +25 -0
  121. package/dist/Grid.mjs +20 -0
  122. package/dist/Grow.cjs +21 -0
  123. package/dist/Grow.d.cts +8 -0
  124. package/dist/Grow.d.mts +8 -0
  125. package/dist/Grow.mjs +20 -0
  126. package/dist/Icon-CpmLCuWc.mjs +916 -0
  127. package/dist/Icon-D8CNaUwd.cjs +927 -0
  128. package/dist/Icon.cjs +4 -0
  129. package/dist/Icon.d.cts +3 -0
  130. package/dist/Icon.d.mts +3 -0
  131. package/dist/Icon.mjs +1 -0
  132. package/dist/Image.cjs +89 -0
  133. package/dist/Image.d.cts +19 -0
  134. package/dist/Image.d.mts +19 -0
  135. package/dist/Image.mjs +89 -0
  136. package/dist/LayoutProvider-DFwC1-h0.d.cts +19 -0
  137. package/dist/LayoutProvider-DFwC1-h0.d.mts +19 -0
  138. package/dist/LayoutProvider-Eb5Vp2BZ.mjs +36 -0
  139. package/dist/LayoutProvider-nB0hiaCR.cjs +41 -0
  140. package/dist/LayoutProvider.cjs +3 -0
  141. package/dist/LayoutProvider.d.cts +2 -0
  142. package/dist/LayoutProvider.d.mts +2 -0
  143. package/dist/LayoutProvider.mjs +1 -0
  144. package/dist/LinearProgress.cjs +232 -0
  145. package/dist/LinearProgress.d.cts +39 -0
  146. package/dist/LinearProgress.d.mts +39 -0
  147. package/dist/LinearProgress.mjs +232 -0
  148. package/dist/Link.cjs +59 -0
  149. package/dist/Link.d.cts +9 -0
  150. package/dist/Link.d.mts +9 -0
  151. package/dist/Link.mjs +59 -0
  152. package/dist/Menu-CEr2M5u0.mjs +229 -0
  153. package/dist/Menu-DA9QNBfE.cjs +245 -0
  154. package/dist/Menu.cjs +174 -0
  155. package/dist/Menu.d.cts +209 -0
  156. package/dist/Menu.d.mts +209 -0
  157. package/dist/Menu.mjs +168 -0
  158. package/dist/MenuItem-D3lzWmIO.cjs +859 -0
  159. package/dist/MenuItem-DzHB9Es6.mjs +807 -0
  160. package/dist/MenuItem.cjs +4 -0
  161. package/dist/MenuItem.d.cts +3 -0
  162. package/dist/MenuItem.d.mts +3 -0
  163. package/dist/MenuItem.mjs +2 -0
  164. package/dist/Modal-BphaFrcw.mjs +300 -0
  165. package/dist/Modal-C5OWwkvp.cjs +328 -0
  166. package/dist/Modal.cjs +8 -0
  167. package/dist/Modal.d.cts +96 -0
  168. package/dist/Modal.d.mts +3 -0
  169. package/dist/Modal.mjs +2 -0
  170. package/dist/NativeSelect.cjs +197 -0
  171. package/dist/NativeSelect.d.cts +65 -0
  172. package/dist/NativeSelect.d.mts +65 -0
  173. package/dist/NativeSelect.mjs +197 -0
  174. package/dist/NavTree.cjs +225 -0
  175. package/dist/NavTree.d.cts +65 -0
  176. package/dist/NavTree.d.mts +65 -0
  177. package/dist/NavTree.mjs +223 -0
  178. package/dist/NumberInput.cjs +513 -0
  179. package/dist/NumberInput.d.cts +96 -0
  180. package/dist/NumberInput.d.mts +96 -0
  181. package/dist/NumberInput.mjs +512 -0
  182. package/dist/Pagination.cjs +258 -0
  183. package/dist/Pagination.d.cts +90 -0
  184. package/dist/Pagination.d.mts +3 -0
  185. package/dist/Pagination.mjs +256 -0
  186. package/dist/Paper.cjs +54 -0
  187. package/dist/Paper.d.cts +2 -0
  188. package/dist/Paper.d.mts +3 -0
  189. package/dist/Paper.mjs +54 -0
  190. package/dist/Popover-DY0ooIAM.cjs +143 -0
  191. package/dist/Popover-DsPTeEPx.mjs +139 -0
  192. package/dist/Popover.cjs +4 -0
  193. package/dist/Popover.d.cts +67 -0
  194. package/dist/Popover.d.mts +67 -0
  195. package/dist/Popover.mjs +2 -0
  196. package/dist/Portal.cjs +22 -0
  197. package/dist/Portal.d.cts +15 -0
  198. package/dist/Portal.d.mts +2 -0
  199. package/dist/Portal.mjs +21 -0
  200. package/dist/Pressable.cjs +134 -0
  201. package/dist/Pressable.d.cts +52 -0
  202. package/dist/Pressable.d.mts +3 -0
  203. package/dist/Pressable.mjs +134 -0
  204. package/dist/Quote.cjs +11 -0
  205. package/dist/Quote.d.cts +15 -0
  206. package/dist/Quote.d.mts +15 -0
  207. package/dist/Quote.mjs +10 -0
  208. package/dist/Radio.cjs +161 -0
  209. package/dist/Radio.d.cts +43 -0
  210. package/dist/Radio.d.mts +43 -0
  211. package/dist/Radio.mjs +161 -0
  212. package/dist/RangeInput.cjs +705 -0
  213. package/dist/RangeInput.d.cts +77 -0
  214. package/dist/RangeInput.d.mts +77 -0
  215. package/dist/RangeInput.mjs +705 -0
  216. package/dist/Rating.cjs +390 -0
  217. package/dist/Rating.d.cts +59 -0
  218. package/dist/Rating.d.mts +59 -0
  219. package/dist/Rating.mjs +390 -0
  220. package/dist/ScrollArea.cjs +282 -0
  221. package/dist/ScrollArea.d.cts +40 -0
  222. package/dist/ScrollArea.d.mts +40 -0
  223. package/dist/ScrollArea.mjs +281 -0
  224. package/dist/Select.cjs +528 -0
  225. package/dist/Select.d.cts +69 -0
  226. package/dist/Select.d.mts +69 -0
  227. package/dist/Select.mjs +528 -0
  228. package/dist/Sidebar.cjs +332 -0
  229. package/dist/Sidebar.d.cts +156 -0
  230. package/dist/Sidebar.d.mts +156 -0
  231. package/dist/Sidebar.mjs +330 -0
  232. package/dist/Skeleton.cjs +90 -0
  233. package/dist/Skeleton.d.cts +24 -0
  234. package/dist/Skeleton.d.mts +24 -0
  235. package/dist/Skeleton.mjs +90 -0
  236. package/dist/Slide.cjs +51 -0
  237. package/dist/Slide.d.cts +14 -0
  238. package/dist/Slide.d.mts +14 -0
  239. package/dist/Slide.mjs +50 -0
  240. package/dist/Snackbar.cjs +216 -0
  241. package/dist/Snackbar.d.cts +81 -0
  242. package/dist/Snackbar.d.mts +81 -0
  243. package/dist/Snackbar.mjs +215 -0
  244. package/dist/StyleSheet.cjs +8 -0
  245. package/dist/StyleSheet.d.cts +2 -0
  246. package/dist/StyleSheet.d.mts +2 -0
  247. package/dist/StyleSheet.mjs +1 -0
  248. package/dist/Switch.cjs +355 -0
  249. package/dist/Switch.d.cts +45 -0
  250. package/dist/Switch.d.mts +45 -0
  251. package/dist/Switch.mjs +355 -0
  252. package/dist/Table.cjs +722 -0
  253. package/dist/Table.d.cts +404 -0
  254. package/dist/Table.d.mts +404 -0
  255. package/dist/Table.mjs +707 -0
  256. package/dist/Tabs.cjs +1227 -0
  257. package/dist/Tabs.d.cts +245 -0
  258. package/dist/Tabs.d.mts +245 -0
  259. package/dist/Tabs.mjs +1222 -0
  260. package/dist/TextInput.cjs +236 -0
  261. package/dist/TextInput.d.cts +82 -0
  262. package/dist/TextInput.d.mts +82 -0
  263. package/dist/TextInput.mjs +236 -0
  264. package/dist/ThemeProvider-DS6pBgE-.cjs +68 -0
  265. package/dist/ThemeProvider-DuhfCo2F.mjs +63 -0
  266. package/dist/ThemeProvider.cjs +4 -0
  267. package/dist/ThemeProvider.d.cts +2 -0
  268. package/dist/ThemeProvider.d.mts +2 -0
  269. package/dist/ThemeProvider.mjs +2 -0
  270. package/dist/ToggleButton.cjs +115 -0
  271. package/dist/ToggleButton.d.cts +51 -0
  272. package/dist/ToggleButton.d.mts +51 -0
  273. package/dist/ToggleButton.mjs +113 -0
  274. package/dist/Tooltip-DQo2zZH0.mjs +485 -0
  275. package/dist/Tooltip-DaB6bJKM.cjs +495 -0
  276. package/dist/Tooltip.cjs +5 -0
  277. package/dist/Tooltip.d.cts +122 -0
  278. package/dist/Tooltip.d.mts +122 -0
  279. package/dist/Tooltip.mjs +2 -0
  280. package/dist/TransferList.cjs +394 -0
  281. package/dist/TransferList.d.cts +69 -0
  282. package/dist/TransferList.d.mts +69 -0
  283. package/dist/TransferList.mjs +394 -0
  284. package/dist/Typography.cjs +69 -0
  285. package/dist/Typography.d.cts +30 -0
  286. package/dist/Typography.d.mts +3 -0
  287. package/dist/Typography.mjs +69 -0
  288. package/dist/View-BmuIFO7p.mjs +75 -0
  289. package/dist/View-DkfIBlcy.cjs +85 -0
  290. package/dist/View.cjs +3 -0
  291. package/dist/View.d.cts +2 -0
  292. package/dist/View.d.mts +2 -0
  293. package/dist/View.mjs +1 -0
  294. package/dist/Zoom.cjs +16 -0
  295. package/dist/Zoom.d.cts +7 -0
  296. package/dist/Zoom.d.mts +7 -0
  297. package/dist/Zoom.mjs +15 -0
  298. package/dist/catalog.cjs +22 -0
  299. package/dist/catalog.d.cts +28 -0
  300. package/dist/catalog.d.mts +28 -0
  301. package/dist/catalog.mjs +21 -0
  302. package/dist/computePopoverPosition-C6qSQ1QD.cjs +126 -0
  303. package/dist/computePopoverPosition-DHV1wQgJ.mjs +121 -0
  304. package/dist/computePopoverPosition-JgOwCM7k.d.cts +12 -0
  305. package/dist/computePopoverPosition-JgOwCM7k.d.mts +12 -0
  306. package/dist/css.cjs +20 -0
  307. package/dist/css.d.cts +2 -0
  308. package/dist/css.d.mts +2 -0
  309. package/dist/css.mjs +1 -0
  310. package/dist/derivedTheme-B0cxTzAq.cjs +29 -0
  311. package/dist/derivedTheme-BB9VVZ08.mjs +24 -0
  312. package/dist/engine.cjs +146 -0
  313. package/dist/engine.d.cts +59 -0
  314. package/dist/engine.d.mts +59 -0
  315. package/dist/engine.mjs +101 -0
  316. package/dist/getElementRef-4m6-x2FS.cjs +18 -0
  317. package/dist/getElementRef-SBx9_7pp.mjs +13 -0
  318. package/dist/index-B7LR7Up3.d.mts +175 -0
  319. package/dist/index-Bgd6kxq_.d.mts +43 -0
  320. package/dist/index-Blc3XujV.d.mts +52 -0
  321. package/dist/index-C21GrYkd.d.mts +96 -0
  322. package/dist/index-CA5HTpT9.d.mts +90 -0
  323. package/dist/index-CD0xu_P6.d.mts +92 -0
  324. package/dist/index-CEtnJkY4.d.cts +92 -0
  325. package/dist/index-CKHGDpGJ.d.mts +33 -0
  326. package/dist/index-CT311xS9.d.cts +175 -0
  327. package/dist/index-CWOcMPWz.d.mts +51 -0
  328. package/dist/index-CmG1wW5D.d.mts +38 -0
  329. package/dist/index-DZFF1vMV.d.cts +1114 -0
  330. package/dist/index-MfIvwyA4.d.mts +1 -0
  331. package/dist/index-Tg9lQlVl.d.mts +30 -0
  332. package/dist/index-UloRwym_.d.mts +16 -0
  333. package/dist/index.cjs +93 -0
  334. package/dist/index.d.cts +3 -0
  335. package/dist/index.d.mts +3 -0
  336. package/dist/index.mjs +17 -0
  337. package/dist/inputVariantStyles-B-4lHxUZ.mjs +41 -0
  338. package/dist/inputVariantStyles-CqCQatKb.cjs +58 -0
  339. package/dist/isRtl-DN-EdUlg.mjs +6 -0
  340. package/dist/isRtl-Dl6QQWib.cjs +11 -0
  341. package/dist/keyframes.cjs +8 -0
  342. package/dist/keyframes.d.cts +2 -0
  343. package/dist/keyframes.d.mts +2 -0
  344. package/dist/keyframes.mjs +1 -0
  345. package/dist/next.cjs +8 -0
  346. package/dist/next.d.cts +2 -0
  347. package/dist/next.d.mts +2 -0
  348. package/dist/next.mjs +1 -0
  349. package/dist/overrides-DeXScOFK.cjs +21 -0
  350. package/dist/overrides-Ds6QZL5Q.mjs +16 -0
  351. package/dist/server.cjs +19 -0
  352. package/dist/server.d.cts +10 -0
  353. package/dist/server.d.mts +10 -0
  354. package/dist/server.mjs +18 -0
  355. package/dist/styleEngine-CLid4cmR.mjs +1 -0
  356. package/dist/styled-DnzWP4pc.cjs +34 -0
  357. package/dist/styled-nr_qC_Yx.mjs +29 -0
  358. package/dist/styled.cjs +3 -0
  359. package/dist/styled.d.cts +2 -0
  360. package/dist/styled.d.mts +2 -0
  361. package/dist/styled.mjs +1 -0
  362. package/dist/testing.cjs +60 -0
  363. package/dist/testing.d.cts +6 -0
  364. package/dist/testing.d.mts +6 -0
  365. package/dist/testing.mjs +59 -0
  366. package/dist/themes-BtfQPcbo.mjs +8 -0
  367. package/dist/themes-k-PEE5O9.cjs +12 -0
  368. package/dist/useAnchoredPlacement-CSotv28V.cjs +116 -0
  369. package/dist/useAnchoredPlacement-VwHtXnAx.mjs +111 -0
  370. package/dist/useDefaultProps-BTQGhvfY.mjs +13 -0
  371. package/dist/useDefaultProps-DratGGIL.cjs +18 -0
  372. package/dist/useDefaultProps.cjs +3 -0
  373. package/dist/useDefaultProps.d.cts +2 -0
  374. package/dist/useDefaultProps.d.mts +2 -0
  375. package/dist/useDefaultProps.mjs +1 -0
  376. package/dist/useLiveValue-CN2SUG2B.cjs +20 -0
  377. package/dist/useLiveValue-CqiwCr56.mjs +15 -0
  378. package/dist/useMediaQuery-acJak9M3.mjs +2 -0
  379. package/dist/useMediaQuery.cjs +9 -0
  380. package/dist/useMediaQuery.d.cts +2 -0
  381. package/dist/useMediaQuery.d.mts +2 -0
  382. package/dist/useMediaQuery.mjs +2 -0
  383. package/dist/useStyle.cjs +14 -0
  384. package/dist/useStyle.d.cts +2 -0
  385. package/dist/useStyle.d.mts +2 -0
  386. package/dist/useStyle.mjs +1 -0
  387. package/dist/useTheme.cjs +8 -0
  388. package/dist/useTheme.d.cts +2 -0
  389. package/dist/useTheme.d.mts +2 -0
  390. package/dist/useTheme.mjs +1 -0
  391. package/dist/useTransition-B4KGUO9m.d.cts +40 -0
  392. package/dist/useTransition-BKBtk0Mb.mjs +78 -0
  393. package/dist/useTransition-BwpSHKSf.d.mts +40 -0
  394. package/dist/useTransition-gHFCJwqF.cjs +83 -0
  395. package/dist/useTransitionChild-C18w474Q.mjs +52 -0
  396. package/dist/useTransitionChild-DD3f44AQ.cjs +57 -0
  397. package/dist/utils-ChXrUitU.mjs +1 -0
  398. package/dist/withStyle.cjs +8 -0
  399. package/dist/withStyle.d.cts +2 -0
  400. package/dist/withStyle.d.mts +2 -0
  401. package/dist/withStyle.mjs +1 -0
  402. package/dist/withTheme.cjs +8 -0
  403. package/dist/withTheme.d.cts +2 -0
  404. package/dist/withTheme.d.mts +2 -0
  405. package/dist/withTheme.mjs +1 -0
  406. package/package.json +908 -3
package/dist/Tabs.mjs ADDED
@@ -0,0 +1,1222 @@
1
+ "use client";
2
+ import "./themes-BtfQPcbo.mjs";
3
+ import { _ as useTheme, f as negate, i as alpha } from "./styleEngine-CLid4cmR.mjs";
4
+ import { t as Icon } from "./Icon-CpmLCuWc.mjs";
5
+ import { n as Tooltip } from "./Tooltip-DQo2zZH0.mjs";
6
+ import { t as styled } from "./styled-nr_qC_Yx.mjs";
7
+ import { t as mergeOverrides } from "./overrides-Ds6QZL5Q.mjs";
8
+ import { t as useDefaultProps } from "./useDefaultProps-BTQGhvfY.mjs";
9
+ import { t as isRtl } from "./isRtl-DN-EdUlg.mjs";
10
+ import { t as View } from "./View-BmuIFO7p.mjs";
11
+ import { t as Menu } from "./Menu-CEr2M5u0.mjs";
12
+ import { t as MenuItem } from "./MenuItem-DzHB9Es6.mjs";
13
+ import { Children, createContext, isValidElement, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
14
+ import { themeDefault } from "@gild-ui/core/theme";
15
+ import { jsx, jsxs } from "react/jsx-runtime";
16
+ import { createShouldForwardProp, props } from "@soroush.tech/styled-system/should-forward-prop";
17
+ import { get, space, system } from "@soroush.tech/styled-system";
18
+ // src/Tabs/TabsContext.ts
19
+ const TabsContext = createContext(null);
20
+ /** Each tab's position among its siblings - its value when it has none of its own. */
21
+ const TabIndexContext = createContext(0);
22
+ function useTabsContext() {
23
+ const tabs = useContext(TabsContext);
24
+ if (!tabs) throw new Error("A Tab must be inside Tabs.");
25
+ return tabs;
26
+ }
27
+ // src/Tabs/utils/dividerLine.ts
28
+ /**
29
+ * The divider - the line along a row of tabs' foot, a column's end side - as an inset shadow,
30
+ * so it adds no size and runs unbroken across the pieces that each draw a stretch of it.
31
+ */
32
+ const getDividerShadow = (theme, isVertical, color) => {
33
+ const thin = theme.borderWidths.thin;
34
+ return `inset ${isVertical ? `${negate(thin)} 0` : `0 ${negate(thin)}`} 0 ${color}`;
35
+ };
36
+ /** The divider's color: the accent in the enclosed look, which outlines the tab in it too. */
37
+ const getDividerColor = (theme, variant, color) => variant === "enclosed" ? get(theme, `palette.${color}.main`) : get(theme, "border.light");
38
+ /**
39
+ * The stretch of the divider an enclosed row's piece draws - its content, a scroll button, an
40
+ * end of the list. The enclosed look draws the line piece by piece, so the selected tab can
41
+ * leave its own piece out.
42
+ */
43
+ const getEnclosedPieceStyle = (theme, { variant, color, orientation, hasDivider }) => hasDivider && variant === "enclosed" ? { boxShadow: getDividerShadow(theme, orientation === "vertical", getDividerColor(theme, variant, color)) } : {};
44
+ // src/Tabs/utils/tonalRadius.ts
45
+ /** The tonal look's radius: a pill, for the container and the selected tab. */
46
+ const TONAL_RADIUS = "999px";
47
+ // src/Tabs/Tab/Tab.tsx
48
+ const shouldForwardProp$1 = createShouldForwardProp([
49
+ "variant",
50
+ "color",
51
+ "textColor",
52
+ "sizeToken",
53
+ "isSelected",
54
+ "isDisabled",
55
+ "iconPlacement",
56
+ "isWrapped",
57
+ "fullWidth",
58
+ "isVertical",
59
+ "hasDivider",
60
+ "selectedBg",
61
+ "bg",
62
+ "borderRadius",
63
+ "lineColor",
64
+ "rowPaddingTop",
65
+ "rowPaddingBottom",
66
+ "isAnnounced"
67
+ ]);
68
+ const getEnclosedEdgeStyle = (theme, main, lineMain, isSelected, isVertical, hasDivider, radius) => {
69
+ const thin = theme.borderWidths.thin;
70
+ const top = `inset 0 ${thin} 0 ${main}`;
71
+ const right = `inset ${negate(thin)} 0 0 ${main}`;
72
+ const foot = `inset 0 ${negate(thin)} 0 ${main}`;
73
+ const left = `inset ${thin} 0 0 ${main}`;
74
+ const outline = isVertical ? [
75
+ top,
76
+ foot,
77
+ left
78
+ ] : [
79
+ top,
80
+ right,
81
+ left
82
+ ];
83
+ let edges = "none";
84
+ if (hasDivider) edges = isSelected ? outline.join(", ") : getDividerShadow(theme, isVertical, lineMain);
85
+ return {
86
+ border: "none",
87
+ padding: thin,
88
+ boxShadow: edges,
89
+ borderRadius: 0,
90
+ ...isVertical ? {
91
+ borderStartStartRadius: radius,
92
+ borderEndStartRadius: radius
93
+ } : {
94
+ borderTopLeftRadius: radius,
95
+ borderTopRightRadius: radius
96
+ }
97
+ };
98
+ };
99
+ const groundOf = (theme, { variant, isSelected, main }, selectedBg, bg) => {
100
+ const groundKey = isSelected && selectedBg ? selectedBg : bg;
101
+ if (groundKey) return get(theme, `background.${groundKey}`);
102
+ return variant === "tonal" && isSelected ? alpha(main, .16) : "transparent";
103
+ };
104
+ const radiusOf = (theme, variant, borderRadius) => {
105
+ if (borderRadius) return theme.radii[borderRadius];
106
+ if (variant === "tonal") return TONAL_RADIUS;
107
+ return variant === "boxed" || variant === "enclosed" ? theme.radii.sm : 0;
108
+ };
109
+ const TabRoot = styled("div", {
110
+ name: "Tab",
111
+ label: "Tab",
112
+ shouldForwardProp: shouldForwardProp$1
113
+ })(({ theme, variant, color, isSelected, isDisabled, fullWidth, isVertical, hasDivider, selectedBg, bg, borderRadius, lineColor }) => {
114
+ const main = get(theme, `palette.${color}.main`);
115
+ const isBoxed = variant === "boxed";
116
+ const outlineColor = isBoxed && isSelected ? alpha(main, .35) : "transparent";
117
+ const raised = get(theme, "background.paper");
118
+ const ground = groundOf(theme, {
119
+ variant,
120
+ isSelected,
121
+ main
122
+ }, selectedBg, bg);
123
+ const radius = radiusOf(theme, variant, borderRadius);
124
+ return {
125
+ position: "relative",
126
+ display: "flex",
127
+ alignItems: "stretch",
128
+ flexGrow: fullWidth ? 1 : 0,
129
+ flexShrink: fullWidth ? 1 : 0,
130
+ flexBasis: fullWidth ? 0 : "auto",
131
+ minWidth: 0,
132
+ backgroundColor: ground,
133
+ border: `${theme.borderWidths.thin} solid ${outlineColor}`,
134
+ borderRadius: radius,
135
+ ...variant === "enclosed" && getEnclosedEdgeStyle(theme, main, get(theme, `palette.${lineColor}.main`), isSelected, isVertical, hasDivider, String(radius)),
136
+ transition: "background-color 0.12s ease",
137
+ ...isDisabled ? {} : { "&:hover": { backgroundColor: isBoxed ? raised : alpha(main, .08) } },
138
+ "&:hover [data-tab-close]": {
139
+ visibility: "visible",
140
+ opacity: 1
141
+ }
142
+ };
143
+ });
144
+ const TabLabel = styled("button", {
145
+ name: "Tab",
146
+ slot: "label",
147
+ label: "TabLabel",
148
+ shouldForwardProp: shouldForwardProp$1
149
+ })(({ theme, variant, color, textColor, sizeToken, isSelected, isDisabled, iconPlacement, isWrapped, isVertical, rowPaddingTop, rowPaddingBottom }) => {
150
+ const { paddingTop, paddingBottom, paddingLeft, paddingRight, fontSize } = theme.sizes[sizeToken];
151
+ const main = get(theme, `palette.${color}.main`);
152
+ const idleColor = get(theme, `text.${textColor ?? "primary"}`);
153
+ let labelColor = isSelected ? variant === "boxed" ? idleColor : main : idleColor;
154
+ if (isDisabled) labelColor = get(theme, "text.disabled");
155
+ return {
156
+ appearance: "none",
157
+ display: "grid",
158
+ gridAutoFlow: iconPlacement === "start" || iconPlacement === "end" ? "column" : "row",
159
+ alignContent: iconPlacement === "bottom" ? "start" : "end",
160
+ alignItems: "center",
161
+ justifyContent: "center",
162
+ justifyItems: "center",
163
+ gap: theme.space[1],
164
+ flex: 1,
165
+ minWidth: 0,
166
+ margin: 0,
167
+ paddingTop: theme.space[isVertical ? paddingTop : rowPaddingTop],
168
+ paddingBottom: theme.space[isVertical ? paddingBottom : rowPaddingBottom],
169
+ paddingLeft: theme.space[paddingLeft],
170
+ paddingRight: theme.space[paddingRight],
171
+ fontFamily: theme.fonts.body,
172
+ fontSize: theme.fontSizes[fontSize],
173
+ lineHeight: theme.lineHeights.base,
174
+ whiteSpace: isWrapped ? "normal" : "nowrap",
175
+ textAlign: "center",
176
+ textDecoration: "none",
177
+ color: labelColor,
178
+ backgroundColor: "transparent",
179
+ border: "none",
180
+ borderRadius: "inherit",
181
+ cursor: isDisabled ? "default" : "pointer",
182
+ outline: "none",
183
+ "&:focus-visible": {
184
+ outline: `${theme.borderWidths.base} solid ${main}`,
185
+ outlineOffset: negate(theme.borderWidths.base)
186
+ }
187
+ };
188
+ });
189
+ const SecondaryActionSlot = styled("div", {
190
+ name: "Tab",
191
+ slot: "secondaryAction",
192
+ label: "TabSecondaryAction"
193
+ })({
194
+ display: "flex",
195
+ alignItems: "center",
196
+ flexShrink: 0
197
+ });
198
+ const TabClose = styled("button", {
199
+ name: "Tab",
200
+ slot: "close",
201
+ label: "TabClose",
202
+ shouldForwardProp: shouldForwardProp$1
203
+ })(({ theme, color, isSelected, isAnnounced }) => {
204
+ const main = get(theme, `palette.${color}.main`);
205
+ return {
206
+ appearance: "none",
207
+ display: "grid",
208
+ placeItems: "center",
209
+ alignSelf: "center",
210
+ flexShrink: 0,
211
+ width: theme.icon.sm,
212
+ height: theme.icon.sm,
213
+ padding: 0,
214
+ marginInlineEnd: theme.space[.5],
215
+ border: "none",
216
+ borderRadius: theme.radii.sm,
217
+ backgroundColor: "transparent",
218
+ color: "inherit",
219
+ cursor: "pointer",
220
+ ...isAnnounced ? {
221
+ opacity: isSelected ? 1 : 0,
222
+ "&:focus-visible": { opacity: 1 }
223
+ } : { visibility: isSelected ? "visible" : "hidden" },
224
+ "&:hover": { backgroundColor: alpha(main, .12) }
225
+ };
226
+ });
227
+ const IconSlot = styled("span", {
228
+ name: "Tab",
229
+ slot: "icon",
230
+ label: "TabIcon"
231
+ })({
232
+ display: "inline-flex",
233
+ flexShrink: 0
234
+ });
235
+ /**
236
+ * @description One tab of a `Tabs`. In a `tablist` it is a `tab` with `aria-selected` and
237
+ * `aria-controls`, the selected one alone in the page's tab order; in a navigation
238
+ * (`Tabs as="nav"`) a button or link marked `aria-current="page"` when it is the current
239
+ * one. It takes one `icon`, which `iconPosition` places on a side of its label.
240
+ */
241
+ function Tab({ value: valueProp, label, icon, iconPosition = "top", isWrapped: isWrappedProp, bg: bgProp, borderRadius: borderRadiusProp, color: colorProp, textColor: textColorProp, size: sizeProp, selectedBg: selectedBgProp, disabled = false, href, as, onClick, title, closeLabel, secondaryAction, className, style, slotProps, "data-testid": dataTestid }) {
242
+ const dp = useDefaultProps("Tab");
243
+ const iconPlacement = icon == null ? void 0 : iconPosition;
244
+ const isIconFirst = iconPlacement === "top" || iconPlacement === "start";
245
+ const iconSlot = icon == null ? null : /* @__PURE__ */ jsx(IconSlot, {
246
+ ...slotProps?.icon,
247
+ "aria-hidden": true,
248
+ children: icon
249
+ });
250
+ const isWrapped = isWrappedProp ?? dp.isWrapped ?? false;
251
+ const bg = bgProp ?? dp.bg;
252
+ const borderRadius = borderRadiusProp ?? dp.borderRadius;
253
+ const tabs = useTabsContext();
254
+ const index = useContext(TabIndexContext);
255
+ const value = valueProp ?? index;
256
+ const isSelected = tabs.selectedValue === value;
257
+ const { isNavigation, select, rowProps } = tabs;
258
+ const color = colorProp ?? rowProps.color ?? dp.color ?? tabs.color;
259
+ const textColor = textColorProp ?? rowProps.textColor ?? dp.textColor ?? tabs.textColor;
260
+ const size = sizeProp ?? rowProps.size ?? dp.size ?? tabs.size;
261
+ const selectedBg = selectedBgProp ?? rowProps.selectedBg ?? dp.selectedBg ?? tabs.selectedBg;
262
+ const handleClick = (event) => {
263
+ if (disabled) {
264
+ event.preventDefault();
265
+ return;
266
+ }
267
+ onClick?.(event);
268
+ select(value);
269
+ };
270
+ const handleFocus = () => {
271
+ if (tabs.shouldSelectOnFocus && !disabled && !isSelected) select(value);
272
+ };
273
+ const isClosable = closeLabel !== void 0;
274
+ const close = () => tabs.onTabClose?.(value);
275
+ const handleMouseDown = (event) => {
276
+ if (isClosable && event.button === 1) event.preventDefault();
277
+ };
278
+ const handleAuxClick = (event) => {
279
+ if (isClosable && event.button === 1) close();
280
+ };
281
+ const handleKeyDown = (event) => {
282
+ if (isClosable && event.key === "Delete") {
283
+ event.preventDefault();
284
+ close();
285
+ }
286
+ };
287
+ const element = as ?? (href === void 0 ? "button" : "a");
288
+ const semantics = isNavigation ? { "aria-current": isSelected ? "page" : void 0 } : {
289
+ role: "tab",
290
+ "aria-selected": isSelected,
291
+ "aria-controls": tabs.getPanelId(value),
292
+ tabIndex: value === tabs.focusableValue ? 0 : -1
293
+ };
294
+ const styleProps = {
295
+ variant: tabs.variant,
296
+ color,
297
+ textColor,
298
+ sizeToken: size,
299
+ isSelected,
300
+ isDisabled: disabled,
301
+ iconPlacement,
302
+ isWrapped,
303
+ fullWidth: tabs.fullWidth,
304
+ isVertical: tabs.isVertical,
305
+ hasDivider: tabs.hasDivider,
306
+ selectedBg,
307
+ bg,
308
+ borderRadius,
309
+ lineColor: tabs.selectedColor,
310
+ rowPaddingTop: tabs.rowPaddingTop,
311
+ rowPaddingBottom: tabs.rowPaddingBottom
312
+ };
313
+ return /* @__PURE__ */ jsxs(TabRoot, {
314
+ ...styleProps,
315
+ role: "presentation",
316
+ ...mergeOverrides(slotProps?.root, {
317
+ style,
318
+ className
319
+ }),
320
+ "data-tab-value": String(value),
321
+ "data-tab-selected": isSelected || void 0,
322
+ children: [
323
+ /* @__PURE__ */ jsxs(TabLabel, {
324
+ ...slotProps?.label,
325
+ ...semantics,
326
+ as: element,
327
+ id: tabs.getTabId(value),
328
+ type: element === "button" ? "button" : void 0,
329
+ href,
330
+ title,
331
+ "aria-disabled": disabled || void 0,
332
+ "aria-keyshortcuts": isClosable ? "Delete" : void 0,
333
+ "data-tab": true,
334
+ "data-testid": dataTestid,
335
+ ...styleProps,
336
+ onClick: handleClick,
337
+ onFocus: handleFocus,
338
+ onMouseDown: handleMouseDown,
339
+ onAuxClick: handleAuxClick,
340
+ onKeyDown: handleKeyDown,
341
+ children: [
342
+ isIconFirst && iconSlot,
343
+ label,
344
+ !isIconFirst && iconSlot
345
+ ]
346
+ }),
347
+ secondaryAction != null && /* @__PURE__ */ jsx(SecondaryActionSlot, {
348
+ ...slotProps?.secondaryAction,
349
+ children: secondaryAction
350
+ }),
351
+ isClosable && /* @__PURE__ */ jsx(Tooltip, {
352
+ title: closeLabel,
353
+ isInteractive: false,
354
+ children: /* @__PURE__ */ jsx(TabClose, {
355
+ ...slotProps?.close,
356
+ type: "button",
357
+ isAnnounced: tabs.shouldAnnounceClose,
358
+ "aria-hidden": tabs.shouldAnnounceClose ? void 0 : true,
359
+ "aria-label": tabs.shouldAnnounceClose ? closeLabel : void 0,
360
+ tabIndex: -1,
361
+ "data-tab-close": true,
362
+ color,
363
+ isSelected,
364
+ onClick: close,
365
+ children: /* @__PURE__ */ jsx(Icon, {
366
+ name: "close",
367
+ size: "0.75rem",
368
+ color: "inherit"
369
+ })
370
+ })
371
+ })
372
+ ]
373
+ });
374
+ }
375
+ // src/Tabs/TabsValueContext.ts
376
+ /** Set by a `TabContext`. */
377
+ const TabsValueContext = createContext(null);
378
+ /** The surrounding `TabContext`'s value, if there is one. */
379
+ const useTabsValue = () => useContext(TabsValueContext);
380
+ // src/Tabs/TabContext/TabContext.tsx
381
+ /**
382
+ * @description Holds which tab is selected for a `Tabs` and the `TabPanel`s beside it, so
383
+ * the two can sit apart in the tree - the tabs in a header, the panels in the body - and
384
+ * still be linked (`aria-controls`, `aria-labelledby`).
385
+ */
386
+ function TabContext({ children, value: valueProp, defaultValue = null, onChange }) {
387
+ const [valueState, setValueState] = useState(defaultValue);
388
+ const value = valueProp === void 0 ? valueState : valueProp;
389
+ const baseId = useId();
390
+ const select = useCallback((next) => {
391
+ setValueState(next);
392
+ onChange?.(next);
393
+ }, [onChange]);
394
+ const context = useMemo(() => ({
395
+ value,
396
+ select,
397
+ baseId
398
+ }), [
399
+ value,
400
+ select,
401
+ baseId
402
+ ]);
403
+ return /* @__PURE__ */ jsx(TabsValueContext.Provider, {
404
+ value: context,
405
+ children
406
+ });
407
+ }
408
+ // src/Tabs/TabScrollButton/TabScrollButton.tsx
409
+ const TabsScrollButtonRoot = styled("button", {
410
+ name: "Tabs",
411
+ slot: "scrollButton",
412
+ label: "TabsScrollButton",
413
+ shouldForwardProp: createShouldForwardProp([
414
+ "isVertical",
415
+ "textColor",
416
+ "isHidden",
417
+ "shouldShowOnMobile",
418
+ "divider"
419
+ ])
420
+ })(({ theme, isVertical, textColor, isHidden, shouldShowOnMobile, divider }) => ({
421
+ ...divider,
422
+ appearance: "none",
423
+ display: "grid",
424
+ placeItems: "center",
425
+ flexShrink: 0,
426
+ alignSelf: "stretch",
427
+ ...isVertical ? { minHeight: theme.space[5] } : { minWidth: theme.icon.lg },
428
+ padding: 0,
429
+ border: "none",
430
+ backgroundColor: "transparent",
431
+ color: get(theme, `text.${textColor}`),
432
+ cursor: "pointer",
433
+ visibility: isHidden ? "hidden" : "visible",
434
+ "&:disabled": {
435
+ color: get(theme, "text.disabled"),
436
+ cursor: "default"
437
+ },
438
+ ...!isVertical && { "[dir=\"rtl\"] & svg": { transform: "scaleX(-1)" } },
439
+ ...!shouldShowOnMobile && { [theme.breakpoints.down("sm")]: { display: "none" } }
440
+ }));
441
+ const TabScrollButtonRoot = styled(TabsScrollButtonRoot, {
442
+ name: "TabScrollButton",
443
+ label: "TabScrollButton"
444
+ })();
445
+ const CHEVRONS = {
446
+ horizontal: {
447
+ start: "chevron_left",
448
+ end: "chevron_right"
449
+ },
450
+ vertical: {
451
+ start: "expand_less",
452
+ end: "expand_more"
453
+ }
454
+ };
455
+ /**
456
+ * @description The button that scrolls a row of tabs - a `Tabs` shows one at each end while its
457
+ * tabs overflow (`overflowBehavior="scroll"`). Out of the tab order and hidden from assistive
458
+ * technology: the arrow keys already reach every tab. A `Tabs` takes another in its place with
459
+ * `slots={{ scrollButton }}`, given these same props.
460
+ */
461
+ function TabScrollButton({ direction, orientation, disabled, isHidden = false, color: colorProp, textColor: textColorProp, onClick, children, className, style, slotProps, "data-testid": dataTestid }) {
462
+ const theme = useTheme();
463
+ const dp = useDefaultProps("TabScrollButton");
464
+ const tabs = useContext(TabsContext);
465
+ const color = colorProp ?? dp.color ?? tabs?.selectedColor;
466
+ const textColor = textColorProp ?? tabs?.rowProps.textColor ?? dp.textColor ?? tabs?.textColor ?? "primary";
467
+ const resolvedOrientation = orientation ?? (tabs?.isVertical ? "vertical" : "horizontal");
468
+ const divider = tabs ? getEnclosedPieceStyle(theme, {
469
+ variant: tabs.variant,
470
+ color,
471
+ orientation: resolvedOrientation,
472
+ hasDivider: tabs.hasDivider
473
+ }) : {};
474
+ return /* @__PURE__ */ jsx(TabScrollButtonRoot, {
475
+ type: "button",
476
+ "aria-hidden": true,
477
+ tabIndex: -1,
478
+ disabled,
479
+ isVertical: resolvedOrientation === "vertical",
480
+ textColor,
481
+ isHidden,
482
+ shouldShowOnMobile: tabs?.shouldShowScrollButtonsOnMobile ?? false,
483
+ divider,
484
+ "data-scroll-direction": direction,
485
+ ...mergeOverrides(slotProps?.root, {
486
+ style,
487
+ className
488
+ }),
489
+ "data-testid": dataTestid,
490
+ onClick,
491
+ children: children ?? /* @__PURE__ */ jsx(Icon, {
492
+ name: CHEVRONS[resolvedOrientation][direction],
493
+ size: "sm",
494
+ color: "inherit"
495
+ })
496
+ });
497
+ }
498
+ // src/Tabs/utils/fitTabs.ts
499
+ /**
500
+ * The tabs that don't fit **whole** in `room` pixels along the row, with `gap` between them -
501
+ * the ones its menu lists. The selected tab counts first, then the others in order while the
502
+ * next still fits; the first that doesn't ends the row, and every one after it goes too, even a
503
+ * later short one, so the row never reads out of order. A tab not measured yet counts as nothing,
504
+ * so it is drawn and measured. With no room measured - nothing laid out - every tab fits.
505
+ */
506
+ const fitTabs = (values, selected, sizes, room, gap) => {
507
+ if (room <= 0) return [];
508
+ const sizeOf = (value) => sizes.get(value) ?? 0;
509
+ const shown = /* @__PURE__ */ new Set();
510
+ let used = 0;
511
+ if (selected !== null && values.includes(selected)) {
512
+ shown.add(selected);
513
+ used = sizeOf(selected);
514
+ }
515
+ for (const value of values) {
516
+ if (value === selected) continue;
517
+ const next = used + (shown.size > 0 ? gap : 0) + sizeOf(value);
518
+ if (next > room) break;
519
+ shown.add(value);
520
+ used = next;
521
+ }
522
+ return values.filter((value) => !shown.has(value));
523
+ };
524
+ // src/Tabs/hooks/useTabsOverflow.ts
525
+ const px = (value) => Number.parseFloat(value) || 0;
526
+ /**
527
+ * The tabs of a row that don't fit whole in its list, for the row's menu - none unless
528
+ * `isEnabled`. Each drawn tab is measured along the row (its `data-tab-value` root) and its size
529
+ * kept, so a tab put in the menu comes back when the room grows. The room is the list's size less
530
+ * its padding, and the gap its own, so the row's own content and the menu's button take their
531
+ * room first. Measured after every render - a tab added, closed or renamed changes the answer -
532
+ * and on every resize of the list; a measurement that changes nothing renders nothing, so the
533
+ * button appearing can't make the row go back and forth. `update` measures again on demand.
534
+ */
535
+ function useTabsOverflow(listRef, isEnabled, isVertical, values, selected) {
536
+ const sizes = useRef(/* @__PURE__ */ new Map());
537
+ const [hidden, setHidden] = useState([]);
538
+ const measure = () => {
539
+ const list = listRef.current;
540
+ let out = [];
541
+ if (isEnabled && list) {
542
+ const valueOf = new Map(values.map((value) => [String(value), value]));
543
+ for (const tab of list.querySelectorAll("[data-tab-value]")) {
544
+ const box = tab.getBoundingClientRect();
545
+ sizes.current.set(valueOf.get(tab.dataset.tabValue), isVertical ? box.height : box.width);
546
+ }
547
+ const style = getComputedStyle(list);
548
+ const room = isVertical ? list.clientHeight - px(style.paddingTop) - px(style.paddingBottom) : list.clientWidth - px(style.paddingLeft) - px(style.paddingRight);
549
+ const gap = px(isVertical ? style.rowGap : style.columnGap);
550
+ out = fitTabs(values, selected, sizes.current, room, gap);
551
+ }
552
+ setHidden((before) => before.length === out.length && before.every((value, at) => value === out[at]) ? before : out);
553
+ };
554
+ const measureRef = useRef(measure);
555
+ useLayoutEffect(() => {
556
+ measureRef.current = measure;
557
+ measure();
558
+ });
559
+ useLayoutEffect(() => {
560
+ const list = listRef.current;
561
+ if (!isEnabled || !list || typeof ResizeObserver === "undefined") return void 0;
562
+ const observer = new ResizeObserver(() => measureRef.current());
563
+ observer.observe(list);
564
+ return () => observer.disconnect();
565
+ }, [listRef, isEnabled]);
566
+ return {
567
+ hidden,
568
+ update: useCallback(() => measureRef.current(), [])
569
+ };
570
+ }
571
+ // src/Tabs/hooks/useTabsScroll.ts
572
+ const AT_REST = {
573
+ isOverflowing: false,
574
+ canScrollStart: false,
575
+ canScrollEnd: false
576
+ };
577
+ /** Where a scrolling list stands, its start edge first whatever the direction. */
578
+ function readScroll(list, isVertical) {
579
+ const size = isVertical ? list.clientHeight : list.clientWidth;
580
+ const total = isVertical ? list.scrollHeight : list.scrollWidth;
581
+ const offset = Math.abs(isVertical ? list.scrollTop : list.scrollLeft);
582
+ return {
583
+ isOverflowing: total > size,
584
+ canScrollStart: offset > 0,
585
+ canScrollEnd: offset + size < total - 1
586
+ };
587
+ }
588
+ /**
589
+ * Keeps track of a scrolling tab list - whether its tabs overflow, and on which side some
590
+ * are out of view - as it scrolls, resizes and re-renders.
591
+ */
592
+ function useTabsScroll(listRef, isEnabled, isVertical) {
593
+ const [state, setState] = useState(AT_REST);
594
+ const update = useCallback(() => {
595
+ if (!isEnabled) return;
596
+ const next = readScroll(listRef.current, isVertical);
597
+ setState((previous) => previous.isOverflowing === next.isOverflowing && previous.canScrollStart === next.canScrollStart && previous.canScrollEnd === next.canScrollEnd ? previous : next);
598
+ }, [
599
+ listRef,
600
+ isEnabled,
601
+ isVertical
602
+ ]);
603
+ useLayoutEffect(update);
604
+ useEffect(() => {
605
+ if (!isEnabled) return void 0;
606
+ const list = listRef.current;
607
+ list.addEventListener("scroll", update);
608
+ window.addEventListener("resize", update);
609
+ const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(update);
610
+ observer?.observe(list);
611
+ return () => {
612
+ list.removeEventListener("scroll", update);
613
+ window.removeEventListener("resize", update);
614
+ observer?.disconnect();
615
+ };
616
+ }, [
617
+ listRef,
618
+ isEnabled,
619
+ update
620
+ ]);
621
+ const scrollByView = (direction) => {
622
+ const list = listRef.current;
623
+ const isReduced = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? false;
624
+ const distance = (!isVertical && isRtl(list) ? -direction : direction) * (isVertical ? list.clientHeight : list.clientWidth);
625
+ list.scrollBy({
626
+ [isVertical ? "top" : "left"]: distance,
627
+ behavior: isReduced ? "auto" : "smooth"
628
+ });
629
+ };
630
+ return {
631
+ ...state,
632
+ update,
633
+ scrollByView
634
+ };
635
+ }
636
+ // src/Tabs/TabListContext.ts
637
+ const TabListContext = createContext(null);
638
+ /** The `TabList` these tabs render for, if any - which links them to their panels. */
639
+ const useTabList = () => useContext(TabListContext);
640
+ // src/Tabs/utils/getNextTab.ts
641
+ /** A tab the keys can reach: not disabled. */
642
+ const isTabEnabled = (tab) => tab.getAttribute("aria-disabled") !== "true";
643
+ /**
644
+ * The enabled tab a key moves focus to from `current`. Disabled tabs are skipped, and
645
+ * `next` past the last tab comes round to the first (and `previous` the other way).
646
+ */
647
+ function getNextTab(tabs, current, step) {
648
+ const enabled = tabs.filter(isTabEnabled);
649
+ if (step === "first") return enabled[0];
650
+ if (step === "last") return enabled.at(-1);
651
+ const index = enabled.indexOf(current);
652
+ if (index === -1) return step === "next" ? enabled[0] : enabled.at(-1);
653
+ const offset = step === "next" ? 1 : -1;
654
+ return enabled.at((index + offset) % enabled.length);
655
+ }
656
+ // src/Tabs/utils/tabIds.ts
657
+ /** A tab's DOM id - what its panel's `aria-labelledby` names. */
658
+ const getTabId = (baseId, value) => `${baseId}-tab-${value}`;
659
+ /** A panel's DOM id - what its tab's `aria-controls` names. */
660
+ const getPanelId = (baseId, value) => `${baseId}-panel-${value}`;
661
+ // src/Tabs/utils/surfaceSystem.ts
662
+ /** `bg` → `theme.background`, `borderRadius` → `theme.radii`: a tab strip's or a panel's surface. */
663
+ const surfaceSystem = system({
664
+ bg: {
665
+ property: "backgroundColor",
666
+ scale: "background"
667
+ },
668
+ borderRadius: {
669
+ property: "borderRadius",
670
+ scale: "radii"
671
+ }
672
+ });
673
+ // src/Tabs/Tabs/Tabs.tsx
674
+ const shouldForwardProp = createShouldForwardProp([
675
+ ...props,
676
+ "variant",
677
+ "color",
678
+ "size",
679
+ "orientation",
680
+ "fullWidth",
681
+ "hasDivider",
682
+ "isCentered"
683
+ ]);
684
+ const TabsRoot = styled("div", {
685
+ name: "Tabs",
686
+ label: "Tabs",
687
+ shouldForwardProp,
688
+ systemProps: [space, surfaceSystem]
689
+ })(({ theme, orientation, variant, color, hasDivider }) => {
690
+ const isVertical = orientation === "vertical";
691
+ return {
692
+ display: "flex",
693
+ ...variant === "tonal" && {
694
+ padding: theme.space[.5],
695
+ borderRadius: "999px",
696
+ backgroundColor: get(theme, "background.secondary")
697
+ },
698
+ flexDirection: isVertical ? "column" : "row",
699
+ alignItems: "stretch",
700
+ minWidth: 0,
701
+ ...hasDivider && variant !== "enclosed" && { boxShadow: getDividerShadow(theme, isVertical, getDividerColor(theme, variant, color)) }
702
+ };
703
+ });
704
+ const TabsList = styled("div", {
705
+ name: "Tabs",
706
+ slot: "list",
707
+ label: "TabsList",
708
+ shouldForwardProp: createShouldForwardProp([
709
+ ...props,
710
+ "variant",
711
+ "color",
712
+ "size",
713
+ "orientation",
714
+ "fullWidth",
715
+ "hasDivider",
716
+ "isCentered",
717
+ "isScrolling",
718
+ "isFitting",
719
+ "hasVisibleScrollbar"
720
+ ])
721
+ })((styleProps) => {
722
+ const { theme, orientation, isCentered, variant, fullWidth, isScrolling, isFitting, hasVisibleScrollbar } = styleProps;
723
+ const isVertical = orientation === "vertical";
724
+ const enclosedEnds = {
725
+ "&::before, &::after": {
726
+ content: "\"\"",
727
+ flexShrink: 0,
728
+ ...getEnclosedPieceStyle(theme, styleProps)
729
+ },
730
+ "&::before": { flexGrow: isCentered ? 1 : 0 },
731
+ "&::after": { flexGrow: isCentered || !fullWidth ? 1 : 0 }
732
+ };
733
+ return {
734
+ position: "relative",
735
+ display: "flex",
736
+ flexDirection: isVertical ? "column" : "row",
737
+ justifyContent: isCentered ? "center" : "flex-start",
738
+ gap: variant === "boxed" || variant === "tonal" ? theme.space[.5] : 0,
739
+ flex: 1,
740
+ minWidth: 0,
741
+ ...variant === "enclosed" && enclosedEnds,
742
+ ...isFitting && { overflow: "hidden" },
743
+ ...isScrolling && {
744
+ [isVertical ? "overflowY" : "overflowX"]: "auto",
745
+ [isVertical ? "overflowX" : "overflowY"]: "hidden",
746
+ ...!hasVisibleScrollbar && {
747
+ scrollbarWidth: "none",
748
+ "&::-webkit-scrollbar": { display: "none" }
749
+ }
750
+ }
751
+ };
752
+ });
753
+ const TabsIndicator = styled("span", {
754
+ name: "Tabs",
755
+ slot: "indicator",
756
+ label: "TabsIndicator",
757
+ shouldForwardProp
758
+ })(({ theme, color, orientation }) => {
759
+ const isVertical = orientation === "vertical";
760
+ return {
761
+ position: "absolute",
762
+ backgroundColor: get(theme, `palette.${color}.main`),
763
+ pointerEvents: "none",
764
+ transition: "left 0.15s ease, width 0.15s ease, top 0.15s ease, height 0.15s ease",
765
+ ...isVertical ? {
766
+ insetInlineEnd: 0,
767
+ width: theme.borderWidths.base
768
+ } : {
769
+ bottom: 0,
770
+ height: theme.borderWidths.base
771
+ },
772
+ "@media (prefers-reduced-motion: reduce)": { transition: "none" }
773
+ };
774
+ });
775
+ const StartContent = styled("div", {
776
+ name: "Tabs",
777
+ slot: "startContent",
778
+ label: "TabsStart",
779
+ shouldForwardProp
780
+ })(({ theme, ...styleProps }) => ({
781
+ display: "flex",
782
+ alignItems: "center",
783
+ flexShrink: 0,
784
+ [styleProps.orientation === "vertical" ? "paddingBlockEnd" : "paddingInlineEnd"]: theme.space[2],
785
+ ...getEnclosedPieceStyle(theme, styleProps)
786
+ }));
787
+ const EndContent = styled("div", {
788
+ name: "Tabs",
789
+ slot: "endContent",
790
+ label: "TabsEnd",
791
+ shouldForwardProp
792
+ })(({ theme, ...styleProps }) => ({
793
+ display: "flex",
794
+ alignItems: "center",
795
+ flexShrink: 0,
796
+ [styleProps.orientation === "vertical" ? "paddingBlockStart" : "paddingInlineStart"]: theme.space[2],
797
+ ...getEnclosedPieceStyle(theme, styleProps)
798
+ }));
799
+ const OverflowButton = styled("button", {
800
+ name: "Tabs",
801
+ slot: "overflowButton",
802
+ label: "TabsOverflowButton",
803
+ shouldForwardProp
804
+ })(({ theme, ...styleProps }) => {
805
+ const main = get(theme, `palette.${styleProps.color}.main`);
806
+ return {
807
+ ...getEnclosedPieceStyle(theme, styleProps),
808
+ appearance: "none",
809
+ display: "grid",
810
+ placeItems: "center",
811
+ flex: "1 1 auto",
812
+ ...styleProps.orientation === "vertical" ? { minHeight: theme.space[5] } : { minWidth: theme.icon.lg },
813
+ padding: 0,
814
+ border: "none",
815
+ backgroundColor: "transparent",
816
+ color: get(theme, "text.primary"),
817
+ cursor: "pointer",
818
+ outline: "none",
819
+ "&:focus-visible": {
820
+ outline: `${theme.borderWidths.base} solid ${main}`,
821
+ outlineOffset: negate(theme.borderWidths.base)
822
+ }
823
+ };
824
+ });
825
+ const OverflowClose = styled("button", {
826
+ name: "Tabs",
827
+ slot: "overflowClose",
828
+ label: "TabsOverflowClose",
829
+ shouldForwardProp
830
+ })(({ theme, color }) => {
831
+ const main = get(theme, `palette.${color}.main`);
832
+ return {
833
+ appearance: "none",
834
+ display: "grid",
835
+ placeItems: "center",
836
+ width: theme.icon.sm,
837
+ height: theme.icon.sm,
838
+ padding: 0,
839
+ border: "none",
840
+ borderRadius: theme.radii.sm,
841
+ backgroundColor: "transparent",
842
+ color: get(theme, "text.secondary"),
843
+ cursor: "pointer",
844
+ "&:hover": { backgroundColor: alpha(main, .12) }
845
+ };
846
+ });
847
+ const overshoot = (start, end, viewStart, viewEnd) => {
848
+ if (start < viewStart) return start - viewStart;
849
+ return Math.max(end - viewEnd, 0);
850
+ };
851
+ const readTabs = (children) => Children.toArray(children).flatMap((child, index) => {
852
+ if (!isValidElement(child)) return [];
853
+ const { value, disabled, label, icon, closeLabel, color, size } = child.props;
854
+ return [{
855
+ value: value ?? index,
856
+ disabled: disabled ?? false,
857
+ label,
858
+ icon,
859
+ closeLabel,
860
+ color,
861
+ size
862
+ }];
863
+ });
864
+ const getLargestSpace = (steps) => steps.reduce((largest, step) => largest === void 0 || Number(step) > Number(largest) ? step : largest, void 0);
865
+ const getFocusableValue = (children, selectedValue) => {
866
+ const enabled = readTabs(children).filter((tab) => !tab.disabled);
867
+ return enabled.find((tab) => tab.value === selectedValue)?.value ?? enabled[0]?.value ?? null;
868
+ };
869
+ const STEP_BY_KEY = {
870
+ Home: "first",
871
+ End: "last"
872
+ };
873
+ /**
874
+ * @description A row of tabs. By default a `tablist`: one tab in the page's tab order, the
875
+ * arrow keys of its orientation moving between tabs, Enter or Space selecting (or moving
876
+ * focus selecting, with `shouldSelectOnFocus`). With `as="nav"`, the same look as a
877
+ * navigation, its current tab marked `aria-current="page"`. Content of the row's own sits
878
+ * before and after the tabs.
879
+ */
880
+ function Tabs({ children, value: valueProp, defaultValue, onChange, onTabClose, shouldAnnounceClose = false, as = "div", orientation = "horizontal", variant: variantProp, color: colorProp, textColor, size: sizeProp, fullWidth = false, isCentered = false, shouldSelectOnFocus = false, overflowBehavior = "none", overflowLabel, scrollButtons = "auto", shouldShowScrollButtonsOnMobile = false, hasVisibleScrollbar = false, hasDivider: hasDividerProp, bg, selectedBg: selectedBgProp, slots, startContent, endContent, action, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, id, className, style, slotProps, "data-testid": dataTestid, ...spaceProps }) {
881
+ const theme = useTheme();
882
+ const dp = useDefaultProps("Tabs");
883
+ const variant = variantProp ?? dp.variant ?? "underline";
884
+ const color = colorProp ?? dp.color ?? themeDefault(theme, "color", "primary");
885
+ const size = sizeProp ?? dp.size ?? themeDefault(theme, "size", "md");
886
+ const hasDivider = hasDividerProp ?? dp.hasDivider ?? (variant !== "boxed" && variant !== "tonal");
887
+ const isFilled = variant === "boxed" || variant === "enclosed" && !hasDivider;
888
+ const selectedBg = selectedBgProp ?? dp.selectedBg ?? (isFilled ? "paper" : void 0);
889
+ const tabList = useTabList();
890
+ const isControlled = valueProp !== void 0;
891
+ const [ownValue, setOwnValue] = useState(defaultValue ?? null);
892
+ const selectedValue = isControlled ? valueProp : ownValue;
893
+ const ownId = useId();
894
+ const baseId = tabList?.baseId ?? ownId;
895
+ const listRef = useRef(null);
896
+ const indicatorRef = useRef(null);
897
+ const isNavigation = as === "nav";
898
+ const isVertical = orientation === "vertical";
899
+ const select = useCallback((next) => {
900
+ if (!isControlled) setOwnValue(next);
901
+ onChange?.(next);
902
+ }, [isControlled, onChange]);
903
+ const focusableValue = getFocusableValue(children, selectedValue);
904
+ const tabDp = useDefaultProps("Tab");
905
+ const selectedColor = readTabs(children).find((tab) => tab.value === selectedValue)?.color ?? colorProp ?? tabDp.color ?? color;
906
+ const tabSizes = readTabs(children).map((tab) => theme.sizes[tab.size ?? sizeProp ?? tabDp.size ?? size]);
907
+ const rowPaddingTop = getLargestSpace(tabSizes.map((tabSize) => tabSize.paddingTop)) ?? theme.sizes[size].paddingTop;
908
+ const rowPaddingBottom = getLargestSpace(tabSizes.map((tabSize) => tabSize.paddingBottom)) ?? theme.sizes[size].paddingBottom;
909
+ const rowProps = useMemo(() => ({
910
+ color: colorProp,
911
+ textColor,
912
+ size: sizeProp,
913
+ selectedBg: selectedBgProp
914
+ }), [
915
+ colorProp,
916
+ textColor,
917
+ sizeProp,
918
+ selectedBgProp
919
+ ]);
920
+ const context = useMemo(() => ({
921
+ selectedValue,
922
+ focusableValue,
923
+ select,
924
+ onTabClose,
925
+ shouldAnnounceClose,
926
+ getTabId: (value) => getTabId(baseId, value),
927
+ getPanelId: (value) => tabList ? getPanelId(baseId, value) : void 0,
928
+ isNavigation,
929
+ isVertical,
930
+ variant,
931
+ color,
932
+ textColor,
933
+ size,
934
+ fullWidth,
935
+ hasDivider,
936
+ selectedBg,
937
+ selectedColor,
938
+ rowPaddingTop,
939
+ rowPaddingBottom,
940
+ rowProps,
941
+ shouldSelectOnFocus,
942
+ shouldShowScrollButtonsOnMobile
943
+ }), [
944
+ selectedValue,
945
+ focusableValue,
946
+ select,
947
+ onTabClose,
948
+ shouldAnnounceClose,
949
+ baseId,
950
+ tabList,
951
+ isNavigation,
952
+ isVertical,
953
+ variant,
954
+ color,
955
+ textColor,
956
+ size,
957
+ fullWidth,
958
+ hasDivider,
959
+ selectedBg,
960
+ selectedColor,
961
+ rowPaddingTop,
962
+ rowPaddingBottom,
963
+ rowProps,
964
+ shouldSelectOnFocus,
965
+ shouldShowScrollButtonsOnMobile
966
+ ]);
967
+ const updateIndicator = useCallback(() => {
968
+ const indicator = indicatorRef.current;
969
+ if (!indicator) return;
970
+ const selected = listRef.current.querySelector("[data-tab-selected]");
971
+ if (!selected) {
972
+ indicator.style.display = "none";
973
+ return;
974
+ }
975
+ indicator.style.display = "block";
976
+ if (isVertical) {
977
+ indicator.style.left = "";
978
+ indicator.style.width = "";
979
+ indicator.style.top = `${selected.offsetTop}px`;
980
+ indicator.style.height = `${selected.offsetHeight}px`;
981
+ } else {
982
+ indicator.style.top = "";
983
+ indicator.style.height = "";
984
+ indicator.style.left = `${selected.offsetLeft}px`;
985
+ indicator.style.width = `${selected.offsetWidth}px`;
986
+ }
987
+ }, [isVertical]);
988
+ useLayoutEffect(updateIndicator);
989
+ const isScrolling = overflowBehavior === "scroll";
990
+ const scroll = useTabsScroll(listRef, isScrolling, isVertical);
991
+ const isFitting = overflowBehavior === "menu";
992
+ const tabs = readTabs(children);
993
+ const overflow = useTabsOverflow(listRef, isFitting, isVertical, tabs.map((tab) => tab.value), focusableValue);
994
+ const hiddenTabs = tabs.filter((tab) => overflow.hidden.includes(tab.value));
995
+ const handleOverflowKeyDown = (event) => {
996
+ if (event.key !== "Delete") return;
997
+ const row = event.target.dataset.value;
998
+ const tab = hiddenTabs.find((hidden) => String(hidden.value) === row);
999
+ if (tab?.closeLabel === void 0) return;
1000
+ event.preventDefault();
1001
+ onTabClose?.(tab.value);
1002
+ };
1003
+ const updateOverflow = isFitting ? overflow.update : scroll.update;
1004
+ useImperativeHandle(action, () => ({
1005
+ updateIndicator,
1006
+ updateOverflow
1007
+ }), [updateIndicator, updateOverflow]);
1008
+ useEffect(() => {
1009
+ if (!isScrolling) return;
1010
+ const row = listRef.current;
1011
+ const selected = row.querySelector("[data-tab-selected]");
1012
+ if (!selected) return;
1013
+ const rowBox = row.getBoundingClientRect();
1014
+ const tabBox = selected.getBoundingClientRect();
1015
+ if (isVertical) row.scrollTop += overshoot(tabBox.top, tabBox.bottom, rowBox.top, rowBox.bottom);
1016
+ else row.scrollLeft += overshoot(tabBox.left, tabBox.right, rowBox.left, rowBox.right);
1017
+ }, [
1018
+ isScrolling,
1019
+ isVertical,
1020
+ selectedValue
1021
+ ]);
1022
+ const hasScrollButtons = isScrolling && (scrollButtons === "always" || scrollButtons === "auto" && scroll.isOverflowing);
1023
+ const ScrollButton = slots?.scrollButton ?? TabScrollButton;
1024
+ const renderScrollButton = (direction) => {
1025
+ const canScroll = direction === -1 ? scroll.canScrollStart : scroll.canScrollEnd;
1026
+ return /* @__PURE__ */ jsx(ScrollButton, {
1027
+ direction: direction === -1 ? "start" : "end",
1028
+ orientation,
1029
+ disabled: scrollButtons === "always" && !canScroll,
1030
+ isHidden: scrollButtons === "auto" && !canScroll,
1031
+ onClick: () => scroll.scrollByView(direction),
1032
+ slotProps: { root: slotProps?.scrollButton }
1033
+ });
1034
+ };
1035
+ const handleKeyDown = (event) => {
1036
+ if (isNavigation || event.target.dataset.tab === void 0) return;
1037
+ const list = event.currentTarget;
1038
+ const forward = isRtl(list) ? "ArrowLeft" : "ArrowRight";
1039
+ const backward = isRtl(list) ? "ArrowRight" : "ArrowLeft";
1040
+ const nextKey = isVertical ? "ArrowDown" : forward;
1041
+ const previousKey = isVertical ? "ArrowUp" : backward;
1042
+ let step = STEP_BY_KEY[event.key];
1043
+ if (event.key === nextKey) step = "next";
1044
+ if (event.key === previousKey) step = "previous";
1045
+ if (!step) return;
1046
+ const target = getNextTab(Array.from(list.querySelectorAll("[data-tab]")), list.ownerDocument.activeElement, step);
1047
+ event.preventDefault();
1048
+ target?.focus();
1049
+ };
1050
+ const styleProps = {
1051
+ variant,
1052
+ color: selectedColor,
1053
+ size,
1054
+ orientation,
1055
+ fullWidth,
1056
+ hasDivider
1057
+ };
1058
+ return /* @__PURE__ */ jsx(TabsContext.Provider, {
1059
+ value: context,
1060
+ children: /* @__PURE__ */ jsxs(TabsRoot, {
1061
+ ...spaceProps,
1062
+ ...styleProps,
1063
+ bg,
1064
+ as,
1065
+ id,
1066
+ ...mergeOverrides(slotProps?.root, {
1067
+ style,
1068
+ className
1069
+ }),
1070
+ "data-testid": dataTestid,
1071
+ "aria-label": isNavigation ? ariaLabel : void 0,
1072
+ "aria-labelledby": isNavigation ? ariaLabelledBy : void 0,
1073
+ children: [
1074
+ startContent != null && /* @__PURE__ */ jsx(StartContent, {
1075
+ ...slotProps?.startContent,
1076
+ ...styleProps,
1077
+ children: startContent
1078
+ }),
1079
+ hasScrollButtons && renderScrollButton(-1),
1080
+ /* @__PURE__ */ jsxs(TabsList, {
1081
+ ...slotProps?.list,
1082
+ ...styleProps,
1083
+ ref: listRef,
1084
+ isCentered,
1085
+ isScrolling,
1086
+ isFitting,
1087
+ hasVisibleScrollbar,
1088
+ role: isNavigation ? void 0 : "tablist",
1089
+ "aria-orientation": isNavigation ? void 0 : orientation,
1090
+ "aria-label": isNavigation ? void 0 : ariaLabel,
1091
+ "aria-labelledby": isNavigation ? void 0 : ariaLabelledBy,
1092
+ onKeyDown: handleKeyDown,
1093
+ children: [Children.toArray(children).map((child, index) => {
1094
+ const value = isValidElement(child) ? child.props.value ?? index : index;
1095
+ if (overflow.hidden.includes(value)) return null;
1096
+ return /* @__PURE__ */ jsx(TabIndexContext.Provider, {
1097
+ value: index,
1098
+ children: child
1099
+ }, isValidElement(child) ? child.key : index);
1100
+ }), variant === "underline" && /* @__PURE__ */ jsx(TabsIndicator, {
1101
+ ...slotProps?.indicator,
1102
+ ...styleProps,
1103
+ ref: indicatorRef,
1104
+ "aria-hidden": true
1105
+ })]
1106
+ }),
1107
+ hasScrollButtons && renderScrollButton(1),
1108
+ hiddenTabs.length > 0 && /* @__PURE__ */ jsx(View, {
1109
+ display: "contents",
1110
+ onKeyDown: handleOverflowKeyDown,
1111
+ children: /* @__PURE__ */ jsx(Menu, {
1112
+ align: "end",
1113
+ onSelect: select,
1114
+ trigger: /* @__PURE__ */ jsx(Tooltip, {
1115
+ title: overflowLabel,
1116
+ isInteractive: false,
1117
+ children: /* @__PURE__ */ jsx(OverflowButton, {
1118
+ ...slotProps?.overflowButton,
1119
+ type: "button",
1120
+ ...styleProps,
1121
+ "aria-label": overflowLabel,
1122
+ children: /* @__PURE__ */ jsx(Icon, {
1123
+ name: "expand_more",
1124
+ size: "sm",
1125
+ color: "inherit"
1126
+ })
1127
+ })
1128
+ }),
1129
+ children: hiddenTabs.map((tab) => /* @__PURE__ */ jsx(MenuItem, {
1130
+ value: tab.value,
1131
+ disabled: tab.disabled,
1132
+ shouldAnnounceSecondaryAction: shouldAnnounceClose,
1133
+ secondaryAction: tab.closeLabel === void 0 ? void 0 : /* @__PURE__ */ jsx(Tooltip, {
1134
+ title: tab.closeLabel,
1135
+ isInteractive: false,
1136
+ children: /* @__PURE__ */ jsx(OverflowClose, {
1137
+ ...slotProps?.overflowClose,
1138
+ type: "button",
1139
+ color: selectedColor,
1140
+ "aria-hidden": shouldAnnounceClose ? void 0 : true,
1141
+ "aria-label": shouldAnnounceClose ? tab.closeLabel : void 0,
1142
+ tabIndex: -1,
1143
+ onClick: () => onTabClose?.(tab.value),
1144
+ children: /* @__PURE__ */ jsx(Icon, {
1145
+ name: "close",
1146
+ size: "0.75rem",
1147
+ color: "inherit"
1148
+ })
1149
+ })
1150
+ }),
1151
+ children: tab.label ?? tab.icon
1152
+ }, tab.value))
1153
+ })
1154
+ }),
1155
+ endContent != null && /* @__PURE__ */ jsx(EndContent, {
1156
+ ...slotProps?.endContent,
1157
+ ...styleProps,
1158
+ children: endContent
1159
+ })
1160
+ ]
1161
+ })
1162
+ });
1163
+ }
1164
+ // src/Tabs/TabList/TabList.tsx
1165
+ /**
1166
+ * @description The `Tabs` of a `TabContext`: it shows the context's value and chooses through it,
1167
+ * and links each tab to its `TabPanel` - the tab `aria-controls` its panel, which is named by
1168
+ * the tab. Everything else is a `Tabs`'.
1169
+ */
1170
+ function TabList({ onChange, ...rest }) {
1171
+ const context = useTabsValue();
1172
+ if (!context) throw new Error("A TabList must be inside a TabContext.");
1173
+ const { baseId, value, select } = context;
1174
+ const link = useMemo(() => ({ baseId }), [baseId]);
1175
+ const handleChange = (next) => {
1176
+ select(next);
1177
+ onChange?.(next);
1178
+ };
1179
+ return /* @__PURE__ */ jsx(TabListContext.Provider, {
1180
+ value: link,
1181
+ children: /* @__PURE__ */ jsx(Tabs, {
1182
+ ...rest,
1183
+ value,
1184
+ onChange: handleChange
1185
+ })
1186
+ });
1187
+ }
1188
+ // src/Tabs/TabPanel/TabPanel.tsx
1189
+ const TabPanelRoot = styled("div", {
1190
+ name: "TabPanel",
1191
+ label: "TabPanel",
1192
+ shouldForwardProp: createShouldForwardProp([...props]),
1193
+ systemProps: [space, surfaceSystem]
1194
+ })({ outline: "none" });
1195
+ /**
1196
+ * @description The content a tab shows: a `role="tabpanel"` named by its tab, which in
1197
+ * turn `aria-controls` it. Shown only while its tab is selected. It sits in a
1198
+ * `TabContext` beside the `Tabs`, which links the two.
1199
+ */
1200
+ function TabPanel({ value, children, shouldKeepMounted: shouldKeepMountedProp, className, style, slotProps, "data-testid": dataTestid, ...spaceProps }) {
1201
+ const dp = useDefaultProps("TabPanel");
1202
+ const shouldKeepMounted = shouldKeepMountedProp ?? dp.shouldKeepMounted ?? false;
1203
+ const tabs = useTabsValue();
1204
+ if (!tabs) throw new Error("A TabPanel must be inside a TabContext.");
1205
+ const { baseId } = tabs;
1206
+ const isSelected = tabs.value === value;
1207
+ return /* @__PURE__ */ jsx(TabPanelRoot, {
1208
+ ...spaceProps,
1209
+ role: "tabpanel",
1210
+ id: getPanelId(baseId, value),
1211
+ "aria-labelledby": getTabId(baseId, value),
1212
+ tabIndex: 0,
1213
+ hidden: !isSelected,
1214
+ ...mergeOverrides(slotProps?.root, {
1215
+ style,
1216
+ className
1217
+ }),
1218
+ "data-testid": dataTestid,
1219
+ children: isSelected || shouldKeepMounted ? children : null
1220
+ });
1221
+ }
1222
+ export { Tab, TabContext, TabList, TabPanel, TabScrollButton, Tabs };