@sentry/scraps 0.4.0 → 0.6.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 (352) hide show
  1. package/README.md +74 -8
  2. package/dist/alert/alert.js +0 -3
  3. package/dist/badge/badge.js +1 -2
  4. package/dist/badge/tag.js +4 -4
  5. package/dist/button/button.js +1 -0
  6. package/dist/button/index.d.ts +0 -1
  7. package/dist/button/index.js +0 -1
  8. package/dist/button/linkButton.js +1 -0
  9. package/dist/button/styles.js +157 -152
  10. package/dist/clipboard/copyToClipboardButton.d.ts +15 -0
  11. package/dist/clipboard/copyToClipboardButton.js +32 -0
  12. package/dist/clipboard/index.d.ts +1 -0
  13. package/dist/clipboard/index.js +1 -0
  14. package/dist/code/index.d.ts +1 -0
  15. package/dist/code/index.js +1 -0
  16. package/dist/codeBlock/codeBlock.d.ts +68 -0
  17. package/dist/codeBlock/codeBlock.js +243 -0
  18. package/dist/codeBlock/index.d.ts +2 -0
  19. package/dist/codeBlock/index.js +2 -0
  20. package/dist/codeBlock/prism.d.ts +11 -0
  21. package/dist/codeBlock/prism.js +101 -0
  22. package/dist/codeBlock/styles.d.ts +2 -0
  23. package/dist/codeBlock/styles.js +133 -0
  24. package/dist/compactSelect/compactSelect.d.ts +21 -0
  25. package/dist/compactSelect/compactSelect.js +150 -0
  26. package/dist/compactSelect/composite.d.ts +54 -0
  27. package/dist/compactSelect/composite.js +101 -0
  28. package/dist/compactSelect/control.d.ts +112 -0
  29. package/dist/compactSelect/control.js +355 -0
  30. package/dist/compactSelect/gridList/index.d.ts +46 -0
  31. package/dist/compactSelect/gridList/index.js +102 -0
  32. package/dist/compactSelect/gridList/option.d.ts +15 -0
  33. package/dist/compactSelect/gridList/option.js +111 -0
  34. package/dist/compactSelect/gridList/section.d.ts +15 -0
  35. package/dist/compactSelect/gridList/section.js +58 -0
  36. package/dist/compactSelect/highlightText.d.ts +6 -0
  37. package/dist/compactSelect/highlightText.js +33 -0
  38. package/dist/compactSelect/index.d.ts +9 -0
  39. package/dist/compactSelect/index.js +8 -0
  40. package/dist/compactSelect/list.d.ts +94 -0
  41. package/dist/compactSelect/list.js +167 -0
  42. package/dist/compactSelect/listBox/index.d.ts +84 -0
  43. package/dist/compactSelect/listBox/index.js +175 -0
  44. package/dist/compactSelect/listBox/option.d.ts +19 -0
  45. package/dist/compactSelect/listBox/option.js +101 -0
  46. package/dist/compactSelect/listBox/section.d.ts +21 -0
  47. package/dist/compactSelect/listBox/section.js +58 -0
  48. package/dist/compactSelect/menuComponents.d.ts +89 -0
  49. package/dist/compactSelect/menuComponents.js +117 -0
  50. package/dist/compactSelect/selectFilterContext.d.ts +2 -0
  51. package/dist/compactSelect/selectFilterContext.js +3 -0
  52. package/dist/compactSelect/styles.d.ts +39 -0
  53. package/dist/compactSelect/styles.js +155 -0
  54. package/dist/compactSelect/types.d.ts +1 -0
  55. package/dist/compactSelect/types.js +0 -0
  56. package/dist/compactSelect/useVirtualizedItems.d.ts +52 -0
  57. package/dist/compactSelect/useVirtualizedItems.js +74 -0
  58. package/dist/compactSelect/utils.d.ts +80 -0
  59. package/dist/compactSelect/utils.js +264 -0
  60. package/dist/confirm/index.d.ts +153 -0
  61. package/dist/confirm/index.js +132 -0
  62. package/dist/dateTime/config.d.ts +23 -0
  63. package/dist/dateTime/config.js +50 -0
  64. package/dist/dateTime/context.d.ts +18 -0
  65. package/dist/dateTime/context.js +46 -0
  66. package/dist/dateTime/dateTime.d.ts +6 -0
  67. package/dist/dateTime/dateTime.js +30 -0
  68. package/dist/dateTime/format.d.ts +24 -0
  69. package/dist/dateTime/format.js +45 -0
  70. package/dist/dateTime/index.d.ts +6 -0
  71. package/dist/dateTime/index.js +6 -0
  72. package/dist/dateTime/intlFormatter.d.ts +9 -0
  73. package/dist/dateTime/intlFormatter.js +16 -0
  74. package/dist/dateTime/parseDate.d.ts +3 -0
  75. package/dist/dateTime/parseDate.js +12 -0
  76. package/dist/descriptionList/descriptionList.js +4 -3
  77. package/dist/disclosure/disclosure.js +2 -2
  78. package/dist/dragHandle/dragHandle.d.ts +3 -1
  79. package/dist/dragHandle/dragHandle.js +8 -5
  80. package/dist/drawer/components.d.ts +46 -0
  81. package/dist/drawer/components.js +265 -0
  82. package/dist/drawer/globalDrawer.d.ts +106 -0
  83. package/dist/drawer/globalDrawer.js +173 -0
  84. package/dist/drawer/index.d.ts +3 -0
  85. package/dist/drawer/index.js +2 -0
  86. package/dist/drawer/useDrawerResizing.d.ts +19 -0
  87. package/dist/drawer/useDrawerResizing.js +111 -0
  88. package/dist/drawer/useDrawerWidth.d.ts +1 -0
  89. package/dist/drawer/useDrawerWidth.js +42 -0
  90. package/dist/dropdownMenu/content.d.ts +1 -0
  91. package/dist/dropdownMenu/content.js +1 -0
  92. package/dist/dropdownMenu/context.d.ts +39 -0
  93. package/dist/dropdownMenu/context.js +3 -0
  94. package/dist/dropdownMenu/dropdownMenu.d.ts +70 -0
  95. package/dist/dropdownMenu/dropdownMenu.js +109 -0
  96. package/dist/dropdownMenu/index.d.ts +2 -0
  97. package/dist/dropdownMenu/index.js +1 -0
  98. package/dist/dropdownMenu/item.d.ts +140 -0
  99. package/dist/dropdownMenu/item.js +142 -0
  100. package/dist/dropdownMenu/list.d.ts +85 -0
  101. package/dist/dropdownMenu/list.js +429 -0
  102. package/dist/dropdownMenu/search.d.ts +16 -0
  103. package/dist/dropdownMenu/search.js +16 -0
  104. package/dist/dropdownMenu/section.d.ts +21 -0
  105. package/dist/dropdownMenu/section.js +40 -0
  106. package/dist/dropdownMenu/separator.d.ts +7 -0
  107. package/dist/dropdownMenu/separator.js +15 -0
  108. package/dist/dropdownMenu/useDropdownMenuKeyboard.d.ts +24 -0
  109. package/dist/dropdownMenu/useDropdownMenuKeyboard.js +31 -0
  110. package/dist/dropdownMenu/useDropdownMenuRowLayout.d.ts +29 -0
  111. package/dist/dropdownMenu/useDropdownMenuRowLayout.js +64 -0
  112. package/dist/dropdownMenu/useDropdownRootMenuState.d.ts +13 -0
  113. package/dist/dropdownMenu/useDropdownRootMenuState.js +30 -0
  114. package/dist/dropdownMenu/useDropdownSubmenuState.d.ts +19 -0
  115. package/dist/dropdownMenu/useDropdownSubmenuState.js +25 -0
  116. package/dist/dropdownMenu/utils.d.ts +21 -0
  117. package/dist/dropdownMenu/utils.js +55 -0
  118. package/dist/duration/formatElapsedDuration.d.ts +4 -0
  119. package/dist/duration/formatElapsedDuration.js +10 -0
  120. package/dist/duration/getDuration.d.ts +68 -0
  121. package/dist/duration/getDuration.js +80 -0
  122. package/dist/duration/index.d.ts +2 -0
  123. package/dist/duration/index.js +2 -0
  124. package/dist/form/FormSearch.d.ts +19 -0
  125. package/dist/form/FormSearch.js +4 -0
  126. package/dist/form/autoSaveForm.d.ts +110 -0
  127. package/dist/form/autoSaveForm.js +100 -0
  128. package/dist/{formPresentation → form}/displayField.js +2 -2
  129. package/dist/form/field/baseField.d.ts +23 -0
  130. package/dist/form/field/baseField.js +116 -0
  131. package/dist/form/field/checkboxField.d.ts +11 -0
  132. package/dist/form/field/checkboxField.js +42 -0
  133. package/dist/form/field/checkboxGroupField.d.ts +16 -0
  134. package/dist/form/field/checkboxGroupField.js +80 -0
  135. package/dist/form/field/compactSelectField.d.ts +19 -0
  136. package/dist/form/field/compactSelectField.js +77 -0
  137. package/dist/{formPresentation → form/field}/fieldIds.js +1 -1
  138. package/dist/form/field/inputField.d.ts +19 -0
  139. package/dist/form/field/inputField.js +31 -0
  140. package/dist/{formPresentation → form/field}/meta.js +6 -6
  141. package/dist/form/field/numberField.d.ts +5 -0
  142. package/dist/form/field/numberField.js +11 -0
  143. package/dist/form/field/passwordField.d.ts +3 -0
  144. package/dist/form/field/passwordField.js +27 -0
  145. package/dist/form/field/radioGroupField.d.ts +16 -0
  146. package/dist/form/field/radioGroupField.js +92 -0
  147. package/dist/form/field/rangeField.d.ts +8 -0
  148. package/dist/form/field/rangeField.js +34 -0
  149. package/dist/form/field/selectAsyncField.d.ts +31 -0
  150. package/dist/form/field/selectAsyncField.js +22 -0
  151. package/dist/form/field/selectField.d.ts +9 -0
  152. package/dist/form/field/selectField.js +72 -0
  153. package/dist/form/field/switchField.d.ts +7 -0
  154. package/dist/form/field/switchField.js +37 -0
  155. package/dist/form/field/textAreaField.d.ts +7 -0
  156. package/dist/form/field/textAreaField.js +25 -0
  157. package/dist/{formPresentation → form}/formContext.js +1 -1
  158. package/dist/form/formErrorContext/index.d.ts +9 -0
  159. package/dist/form/formErrorContext/index.js +7 -0
  160. package/dist/form/index.d.ts +9 -0
  161. package/dist/form/index.js +8 -0
  162. package/dist/{formPresentation → form/layout}/base.d.ts +1 -1
  163. package/dist/{formPresentation → form/layout}/base.js +1 -1
  164. package/dist/form/layout/fieldGroup.d.ts +6 -0
  165. package/dist/form/layout/fieldGroup.js +60 -0
  166. package/dist/{formPresentation/fieldLayout.d.ts → form/layout/index.d.ts} +1 -1
  167. package/dist/{formPresentation/fieldLayout.js → form/layout/index.js} +3 -3
  168. package/dist/{formPresentation → form/layout}/useStackedLayout.js +1 -1
  169. package/dist/form/scrapsForm.d.ts +220 -0
  170. package/dist/form/scrapsForm.js +126 -0
  171. package/dist/fzf.d.ts +9 -0
  172. package/dist/fzf.js +155 -0
  173. package/dist/hotkey/hotkey.d.ts +9 -8
  174. package/dist/hotkey/hotkey.js +13 -6
  175. package/dist/hotkey/index.d.ts +2 -1
  176. package/dist/hotkey/index.js +2 -1
  177. package/dist/hotkey/keyMappings.d.ts +1 -15
  178. package/dist/hotkey/keyMappings.js +29 -174
  179. package/dist/hotkey/useHotkeys.d.ts +3 -47
  180. package/dist/hotkey/useHotkeys.js +8 -42
  181. package/dist/image/image.js +2 -1
  182. package/dist/info/infoTip.d.ts +1 -1
  183. package/dist/info/infoTip.js +4 -3
  184. package/dist/input/index.d.ts +0 -3
  185. package/dist/input/index.js +0 -2
  186. package/dist/input/input.d.ts +2 -0
  187. package/dist/input/input.js +2 -0
  188. package/dist/input/passwordManagerIgnoreProps.d.ts +11 -0
  189. package/dist/input/passwordManagerIgnoreProps.js +8 -0
  190. package/dist/layout/container.d.ts +8 -2
  191. package/dist/layout/container.js +2 -2
  192. package/dist/layout/index.d.ts +2 -2
  193. package/dist/layout/index.js +1 -1
  194. package/dist/layout/styles.d.ts +2 -1
  195. package/dist/layout/styles.js +11 -5
  196. package/dist/legacyDatetime.d.ts +21 -0
  197. package/dist/legacyDatetime.js +13 -0
  198. package/dist/link/index.d.ts +1 -1
  199. package/dist/link/index.js +1 -1
  200. package/dist/link/link.js +4 -3
  201. package/dist/link/linkBehaviorContext.d.ts +11 -0
  202. package/dist/link/linkBehaviorContext.js +48 -11
  203. package/dist/menu/index.d.ts +1 -1
  204. package/dist/menu/index.js +1 -1
  205. package/dist/menu/menu.d.ts +14 -8
  206. package/dist/menu/menu.js +163 -60
  207. package/dist/modal/components.d.ts +19 -0
  208. package/dist/modal/components.js +99 -0
  209. package/dist/modal/errorBoundary.d.ts +2 -0
  210. package/dist/modal/errorBoundary.js +35 -0
  211. package/dist/modal/index.d.ts +33 -0
  212. package/dist/modal/index.js +260 -0
  213. package/dist/modal/portal.d.ts +1 -0
  214. package/dist/modal/portal.js +10 -0
  215. package/dist/modal/state.d.ts +17 -0
  216. package/dist/modal/state.js +41 -0
  217. package/dist/modal/types.d.ts +75 -0
  218. package/dist/modal/types.js +0 -0
  219. package/dist/numberInput/index.d.ts +3 -0
  220. package/dist/numberInput/index.js +2 -0
  221. package/dist/{input → numberInput}/numberDragInput.d.ts +1 -1
  222. package/dist/{input → numberInput}/numberDragInput.js +1 -1
  223. package/dist/{input → numberInput}/numberInput.d.ts +1 -1
  224. package/dist/{input → numberInput}/numberInput.js +1 -1
  225. package/dist/overlayContext.d.ts +29 -0
  226. package/dist/overlayContext.js +7 -0
  227. package/dist/pagination/index.d.ts +1 -0
  228. package/dist/pagination/index.js +1 -0
  229. package/dist/pagination/pagination.d.ts +24 -0
  230. package/dist/pagination/pagination.js +63 -0
  231. package/dist/pictureInPicture/index.d.ts +2 -0
  232. package/dist/pictureInPicture/index.js +2 -0
  233. package/dist/pictureInPicture/pictureInPicture.d.ts +47 -0
  234. package/dist/pictureInPicture/pictureInPicture.js +100 -0
  235. package/dist/pictureInPicture/pictureInPicturePortal.d.ts +16 -0
  236. package/dist/pictureInPicture/pictureInPicturePortal.js +46 -0
  237. package/dist/pictureInPicture/portalContext.d.ts +2 -0
  238. package/dist/pictureInPicture/portalContext.js +3 -0
  239. package/dist/relativeTime/getRelativeDate.d.ts +14 -0
  240. package/dist/relativeTime/getRelativeDate.js +107 -0
  241. package/dist/relativeTime/index.d.ts +3 -0
  242. package/dist/relativeTime/index.js +3 -0
  243. package/dist/relativeTime/relativeTime.d.ts +55 -0
  244. package/dist/relativeTime/relativeTime.js +102 -0
  245. package/dist/relativeTime/useRelativeTimeFormatter.d.ts +2 -0
  246. package/dist/relativeTime/useRelativeTimeFormatter.js +10 -0
  247. package/dist/revealOnHover/revealOnHover.js +1 -1
  248. package/dist/segmentedControl/segmentedControl.js +1 -1
  249. package/dist/select/filter.d.ts +4 -0
  250. package/dist/select/filter.js +12 -0
  251. package/dist/select/index.d.ts +3 -0
  252. package/dist/select/index.js +2 -0
  253. package/dist/select/option.d.ts +16 -0
  254. package/dist/select/option.js +81 -0
  255. package/dist/select/reactSelectWrapper.d.ts +8 -0
  256. package/dist/select/reactSelectWrapper.js +25 -0
  257. package/dist/select/select.d.ts +79 -0
  258. package/dist/select/select.js +454 -0
  259. package/dist/select/styles.d.ts +9 -0
  260. package/dist/select/styles.js +27 -0
  261. package/dist/select/types.d.ts +60 -0
  262. package/dist/select/types.js +0 -0
  263. package/dist/select/virtualizedMenuList.d.ts +24 -0
  264. package/dist/select/virtualizedMenuList.js +123 -0
  265. package/dist/slideOverPanel.d.ts +20 -0
  266. package/dist/slideOverPanel.js +141 -0
  267. package/dist/splitPanel/splitPanel.d.ts +3 -1
  268. package/dist/splitPanel/splitPanel.js +2 -1
  269. package/dist/table/table.d.ts +1 -1
  270. package/dist/table/table.js +39 -20
  271. package/dist/table/useColumnResize.d.ts +6 -5
  272. package/dist/table/useColumnResize.js +5 -4
  273. package/dist/tabs/context.d.ts +9 -0
  274. package/dist/tabs/context.js +9 -0
  275. package/dist/tabs/index.d.ts +2 -0
  276. package/dist/tabs/index.js +1 -0
  277. package/dist/tabs/item.d.ts +24 -0
  278. package/dist/tabs/item.js +4 -0
  279. package/dist/tabs/tab.d.ts +22 -0
  280. package/dist/tabs/tab.js +208 -0
  281. package/dist/tabs/tabList.d.ts +18 -0
  282. package/dist/tabs/tabList.js +258 -0
  283. package/dist/tabs/tabPanels.d.ts +13 -0
  284. package/dist/tabs/tabPanels.js +62 -0
  285. package/dist/tabs/tabs.d.ts +53 -0
  286. package/dist/tabs/tabs.js +59 -0
  287. package/dist/tabs/utils.d.ts +3 -0
  288. package/dist/tabs/utils.js +6 -0
  289. package/dist/text/heading.d.ts +1 -1
  290. package/dist/text/heading.js +1 -1
  291. package/dist/text/prose.d.ts +2 -2
  292. package/dist/text/styles.js +1 -1
  293. package/dist/text/text.d.ts +1 -1
  294. package/dist/text/text.js +1 -1
  295. package/dist/theme/dark.js +9 -9
  296. package/dist/theme/light.js +9 -9
  297. package/dist/theme/theme.d.ts +34 -34
  298. package/dist/theme/theme.js +9 -0
  299. package/dist/theme/types.d.ts +20 -2
  300. package/dist/tooltip/tooltip.js +2 -5
  301. package/dist/translation/index.d.ts +1 -0
  302. package/dist/translation/index.js +1 -0
  303. package/dist/translation/translate.d.ts +9 -0
  304. package/dist/translation/translate.js +5 -0
  305. package/dist/translation/translationContext.d.ts +2 -1
  306. package/dist/translation/translationContext.js +2 -1
  307. package/dist/useMedia.d.ts +15 -0
  308. package/dist/useMedia.js +24 -0
  309. package/dist/useOnClickOutside.d.ts +2 -0
  310. package/dist/useOnClickOutside.js +22 -0
  311. package/dist/useOverlay.d.ts +1 -0
  312. package/dist/useOverlay.js +1 -0
  313. package/dist/useVirtualCollection.d.ts +154 -0
  314. package/dist/useVirtualCollection.js +143 -0
  315. package/dist/useVirtualRows.d.ts +26 -0
  316. package/dist/useVirtualRows.js +26 -0
  317. package/dist/virtualCollectionLayout.d.ts +51 -0
  318. package/dist/virtualCollectionLayout.js +49 -0
  319. package/fonts/OFL.txt +94 -0
  320. package/fonts/roboto-mono-variable-cyrillic-ext.woff2 +0 -0
  321. package/fonts/roboto-mono-variable-cyrillic.woff2 +0 -0
  322. package/fonts/roboto-mono-variable-greek.woff2 +0 -0
  323. package/fonts/roboto-mono-variable-latin-ext.woff2 +0 -0
  324. package/fonts/roboto-mono-variable-vietnamese.woff2 +0 -0
  325. package/fonts/roboto-mono-variable.woff2 +0 -0
  326. package/fonts/rubik-variable-cyrillic-ext.woff2 +0 -0
  327. package/fonts/rubik-variable-cyrillic.woff2 +0 -0
  328. package/fonts/rubik-variable-latin-ext.woff2 +0 -0
  329. package/fonts/rubik-variable.woff2 +0 -0
  330. package/fonts.css +211 -0
  331. package/package.json +140 -23
  332. package/dist/datetime.d.ts +0 -39
  333. package/dist/datetime.js +0 -20
  334. package/dist/formPresentation/index.d.ts +0 -8
  335. package/dist/formPresentation/index.js +0 -8
  336. package/dist/interactionStateLayer/index.d.ts +0 -1
  337. package/dist/interactionStateLayer/index.js +0 -1
  338. package/dist/interactionStateLayer/interactionStateLayer.d.ts +0 -23
  339. package/dist/interactionStateLayer/interactionStateLayer.js +0 -67
  340. package/dist/unreachable.d.ts +0 -1
  341. package/dist/unreachable.js +0 -4
  342. /package/dist/{formPresentation → form}/autoSaveContext.d.ts +0 -0
  343. /package/dist/{formPresentation → form}/autoSaveContext.js +0 -0
  344. /package/dist/{formPresentation → form}/displayField.d.ts +0 -0
  345. /package/dist/{formPresentation → form/field}/fieldIds.d.ts +0 -0
  346. /package/dist/{formPresentation → form/field}/groupContext.d.ts +0 -0
  347. /package/dist/{formPresentation → form/field}/groupContext.js +0 -0
  348. /package/dist/{formPresentation → form/field}/meta.d.ts +0 -0
  349. /package/dist/{formPresentation → form}/formContext.d.ts +0 -0
  350. /package/dist/{formPresentation → form}/icons.d.ts +0 -0
  351. /package/dist/{formPresentation → form}/icons.js +0 -0
  352. /package/dist/{formPresentation → form/layout}/useStackedLayout.d.ts +0 -0
@@ -0,0 +1,208 @@
1
+ import { jsx, jsxs } from "@emotion/react/jsx-runtime";
2
+ import { Fragment, useContext, useRef } from "react";
3
+ import { css } from "@emotion/react";
4
+ import styled from "@emotion/styled";
5
+ import { useTab } from "@react-aria/tabs";
6
+ import { useObjectRef } from "@react-aria/utils";
7
+ import { Link } from "../link/index.js";
8
+ import { Tooltip } from "../tooltip/index.js";
9
+ import { TabsContext } from "./context.js";
10
+ import { isModifiedClick, tabsShouldForwardProp } from "./utils.js";
11
+ const StyledTabWrap = styled('li', {
12
+ shouldForwardProp: tabsShouldForwardProp
13
+ })`
14
+ color: ${(p)=>p.selected ? p.theme.tokens.interactive.link.accent.rest : p.theme.tokens.interactive.link.neutral.rest};
15
+ white-space: nowrap;
16
+ cursor: pointer;
17
+
18
+ &:focus-visible {
19
+ outline: none;
20
+ }
21
+
22
+ &[aria-disabled] {
23
+ opacity: 0.6;
24
+ cursor: default;
25
+ }
26
+
27
+ ${(p)=>p.overflowing && css`
28
+ display: none;
29
+ pointer-events: none;
30
+ `}
31
+ `;
32
+ const paddingPerSize = (theme, orientation)=>({
33
+ md: 'horizontal' === orientation ? `10px ${theme.space.xl}` : `10px ${theme.space.md}`,
34
+ sm: 'horizontal' === orientation ? `${theme.space.md} ${theme.space.lg}` : `${theme.space.md} ${theme.space.sm}`,
35
+ xs: 'horizontal' === orientation ? `${theme.space.sm} ${theme.space.md}` : `${theme.space.sm} ${theme.space.xs}`
36
+ });
37
+ const selectionIndicatorSize = '2px';
38
+ const innerWrapStyles = ({ theme, orientation, variant, size, selected })=>css`
39
+ display: flex;
40
+ align-items: center;
41
+ position: relative;
42
+ height: ${theme.form[size].height};
43
+ min-height: ${theme.form[size].minHeight};
44
+ font-size: ${theme.form[size].fontSize};
45
+ line-height: ${theme.form[size].lineHeight};
46
+ padding: ${paddingPerSize(theme, orientation)[size]};
47
+ border-radius: ${theme.radius.md};
48
+ transform: translateY(1px);
49
+ margin-bottom: ${'horizontal' === orientation && 'flat' === variant ? theme.space.xs : 0};
50
+
51
+ ${'horizontal' === orientation ? css`
52
+ gap: ${theme.space.md};
53
+ ` : css`
54
+ gap: ${theme.space.sm};
55
+ /**
56
+ * To align the SelectionIndicator (2px width, 4px spacing)
57
+ */
58
+ margin-left: ${'flat' === variant ? `calc(${theme.space.xs} + ${selectionIndicatorSize})` : 0};
59
+ /* static padding towards SelectionIndicator */
60
+ padding-left: ${theme.space.md};
61
+ `}
62
+
63
+ li[aria-disabled]:hover & {
64
+ background-color: transparent;
65
+ }
66
+
67
+ &:focus-visible,
68
+ li:focus-visible & {
69
+ outline: none;
70
+ box-shadow: inset 0 0 0 2px ${theme.tokens.focus.default};
71
+ }
72
+
73
+ li:not([aria-disabled]):hover & {
74
+ background-color: ${selected ? 'floating' === variant ? theme.tokens.interactive.transparent.accent.selected.background.hover : theme.tokens.interactive.transparent.accent.selected.background.rest : theme.tokens.interactive.transparent.neutral.background.hover};
75
+ color: ${selected ? theme.tokens.interactive.link.accent.hover : theme.tokens.interactive.link.neutral.hover};
76
+ }
77
+
78
+ li:not([aria-disabled]):active & {
79
+ background-color: ${selected ? 'floating' === variant ? theme.tokens.interactive.transparent.accent.selected.background.active : theme.tokens.interactive.transparent.accent.selected.background.hover : theme.tokens.interactive.transparent.neutral.background.active};
80
+ color: ${selected ? theme.tokens.interactive.link.accent.active : theme.tokens.interactive.link.neutral.active};
81
+ }
82
+
83
+ ${'floating' === variant && selected && css`
84
+ background-color: ${theme.tokens.interactive.transparent.accent.selected.background.rest};
85
+ `}
86
+ `;
87
+ const StyledTabSelectionIndicator = styled('div')`
88
+ position: absolute;
89
+ border-radius: 1px;
90
+ pointer-events: none;
91
+ background: ${(p)=>p.selected ? p.theme.tokens.graphics.accent.vibrant : 'transparent'};
92
+
93
+ li[aria-disabled] & {
94
+ opacity: 0.6;
95
+ }
96
+
97
+ ${(p)=>'horizontal' === p.orientation ? css`
98
+ width: 100%;
99
+ height: ${selectionIndicatorSize};
100
+
101
+ bottom: 0;
102
+ left: 50%;
103
+ transform: translate(-50%, ${p.theme.space.xs});
104
+ ` : css`
105
+ width: ${selectionIndicatorSize};
106
+ height: 50%;
107
+
108
+ left: -6px;
109
+ top: 50%;
110
+ transform: translateY(-50%);
111
+ `}
112
+ `;
113
+ function Tab({ ref, item, state, orientation, overflowing, variant = 'flat', size, as = 'li', tooltipProps }) {
114
+ const { rootProps: { onChange } } = useContext(TabsContext);
115
+ const wrapperRef = useObjectRef(ref);
116
+ const controlRef = useRef(null);
117
+ const { key, rendered, props: { to, hidden } } = item;
118
+ const { tabProps, isSelected, isDisabled } = useTab({
119
+ key,
120
+ isDisabled: hidden,
121
+ shouldSelectOnPressUp: void 0 !== to
122
+ }, state, controlRef);
123
+ const isLink = void 0 !== to && !isDisabled;
124
+ const styleProps = {
125
+ orientation,
126
+ variant,
127
+ selected: isSelected,
128
+ size
129
+ };
130
+ const content = /*#__PURE__*/ jsxs(Fragment, {
131
+ children: [
132
+ rendered,
133
+ 'flat' === variant && /*#__PURE__*/ jsx(StyledTabSelectionIndicator, {
134
+ orientation: orientation,
135
+ selected: isSelected
136
+ })
137
+ ]
138
+ });
139
+ const tab = /*#__PURE__*/ jsx(TabWrap, {
140
+ ...isLink ? {
141
+ role: 'presentation'
142
+ } : tabProps,
143
+ hidden: hidden,
144
+ "aria-disabled": isDisabled || void 0,
145
+ selected: isSelected,
146
+ overflowing: overflowing,
147
+ ref: (element)=>{
148
+ wrapperRef.current = element;
149
+ if (!isLink) controlRef.current = element;
150
+ },
151
+ as: as,
152
+ children: isLink ? /*#__PURE__*/ jsx(TabLink, {
153
+ ...tabProps,
154
+ ...styleProps,
155
+ to: to,
156
+ ref: (element)=>{
157
+ controlRef.current = element;
158
+ },
159
+ onMouseDown: (event)=>{
160
+ if (!isModifiedClick(event)) tabProps.onMouseDown?.(event);
161
+ },
162
+ onPointerDown: (event)=>{
163
+ if (!isModifiedClick(event)) tabProps.onPointerDown?.(event);
164
+ },
165
+ onClick: (event)=>{
166
+ onChange?.(String(key));
167
+ if (!isModifiedClick(event)) tabProps.onClick?.(event);
168
+ },
169
+ onKeyDown: (event)=>{
170
+ if (' ' === event.key) event.preventDefault();
171
+ tabProps.onKeyDown?.(event);
172
+ },
173
+ children: content
174
+ }) : /*#__PURE__*/ jsx(TabInnerWrap, {
175
+ ...styleProps,
176
+ children: content
177
+ })
178
+ });
179
+ return tooltipProps ? /*#__PURE__*/ jsx(Tooltip, {
180
+ ...tooltipProps,
181
+ children: tab
182
+ }) : tab;
183
+ }
184
+ const TabWrap = StyledTabWrap;
185
+ const TabLink = styled(Link)`
186
+ ${(p)=>innerWrapStyles({
187
+ variant: p.variant,
188
+ selected: p.selected,
189
+ orientation: p.orientation,
190
+ theme: p.theme,
191
+ size: p.size
192
+ })}
193
+
194
+ &,
195
+ &:hover {
196
+ color: inherit;
197
+ }
198
+ `;
199
+ const TabInnerWrap = styled('span')`
200
+ ${(p)=>innerWrapStyles({
201
+ variant: p.variant,
202
+ selected: p.selected,
203
+ orientation: p.orientation,
204
+ size: p.size,
205
+ theme: p.theme
206
+ })}
207
+ `;
208
+ export { Tab };
@@ -0,0 +1,18 @@
1
+ import type { CSSProperties } from 'react';
2
+ import type { TabListStateOptions } from '@react-stately/tabs';
3
+ import type { InternalTabListItemProps } from './item.js';
4
+ import type { TabProps } from './tab.js';
5
+ export interface TabListProps {
6
+ children: TabListStateOptions<InternalTabListItemProps>['children'];
7
+ className?: string;
8
+ outerWrapStyles?: CSSProperties;
9
+ variant?: TabProps['variant'];
10
+ }
11
+ /**
12
+ * To be used as a direct child of the `<Tabs />` component. See example usage
13
+ * in tabs.stories.js
14
+ */
15
+ export declare function TabList({ variant, ...props }: TabListProps): import("@emotion/react/jsx-runtime").JSX.Element;
16
+ export declare namespace TabList {
17
+ var Item: (props: InternalTabListItemProps) => import("react").JSX.Element;
18
+ }
@@ -0,0 +1,258 @@
1
+ import { jsx, jsxs } from "@emotion/react/jsx-runtime";
2
+ import { createElement, css } from "@emotion/react";
3
+ import { useContext, useEffect, useEffectEvent, useLayoutEffect, useMemo, useRef, useState } from "react";
4
+ import styled from "@emotion/styled";
5
+ import { useTabList } from "@react-aria/tabs";
6
+ import { useCollection } from "@react-stately/collections";
7
+ import { ListCollection } from "@react-stately/list";
8
+ import { useTabListState } from "@react-stately/tabs";
9
+ import { IconEllipsis } from "@sentry/icons/ellipsis";
10
+ import { DropdownMenu } from "../dropdownMenu/index.js";
11
+ import { Container, Flex } from "../layout/index.js";
12
+ import { OverlayTrigger } from "../overlayTrigger.js";
13
+ import { useTranslation } from "../translation/useTranslation.js";
14
+ import { TabsContext } from "./context.js";
15
+ import { TabListItem } from "./item.js";
16
+ import { Tab } from "./tab.js";
17
+ import { tabsShouldForwardProp } from "./utils.js";
18
+ const StyledTabListWrap = styled('ul', {
19
+ shouldForwardProp: tabsShouldForwardProp
20
+ })`
21
+ position: relative;
22
+ display: grid;
23
+ padding: 0;
24
+ margin: 0;
25
+ list-style-type: none;
26
+ flex-shrink: 0;
27
+ gap: ${(p)=>p.theme.space.xs};
28
+
29
+ ${(p)=>'horizontal' === p.orientation ? css`
30
+ grid-auto-flow: column;
31
+ justify-content: start;
32
+ ` : css`
33
+ height: 100%;
34
+ grid-auto-flow: row;
35
+ align-content: start;
36
+ padding-right: ${p.theme.space.xs};
37
+ `}
38
+ `;
39
+ const StyledTabListOverflowWrap = styled('div')`
40
+ position: absolute;
41
+ right: 0;
42
+ top: 50%;
43
+ transform: translateY(-50%);
44
+ z-index: ${(p)=>p.theme.zIndex.dropdown};
45
+ `;
46
+ const RESERVED_OVERFLOW_TRIGGER_WIDTH = 48;
47
+ function useOverflowTabs({ outerWrapRef, tabListRef, tabItemsRef, tabItems, disabled }) {
48
+ const [overflowTabs, setOverflowTabs] = useState([]);
49
+ const tabWidthsRef = useRef(new Map());
50
+ const recompute = useEffectEvent(()=>{
51
+ if (disabled) return void setOverflowTabs((prev)=>0 === prev.length ? prev : []);
52
+ const outerWrap = outerWrapRef.current;
53
+ const tabList = tabListRef.current;
54
+ if (!outerWrap || !tabList) return;
55
+ const elements = tabItemsRef.current ?? {};
56
+ const gap = parseFloat(getComputedStyle(tabList).columnGap) || 0;
57
+ const keys = tabItems.filter((item)=>!item.hidden).map((item)=>item.key);
58
+ for (const key of keys){
59
+ const measured = elements[key]?.getBoundingClientRect().width ?? 0;
60
+ if (measured > 0) tabWidthsRef.current.set(key, measured);
61
+ }
62
+ const available = outerWrap.getBoundingClientRect().width;
63
+ const fullWidth = keys.reduce((sum, key, index)=>sum + (tabWidthsRef.current.get(key) ?? 0) + (0 === index ? 0 : gap), 0);
64
+ let nextOverflow;
65
+ if (fullWidth <= available) nextOverflow = [];
66
+ else {
67
+ const budget = available - RESERVED_OVERFLOW_TRIGGER_WIDTH;
68
+ nextOverflow = [];
69
+ let used = 0;
70
+ let isOverflowing = false;
71
+ keys.forEach((key, index)=>{
72
+ if (isOverflowing) return void nextOverflow.push(key);
73
+ const nextUsed = used + (tabWidthsRef.current.get(key) ?? 0) + (0 === index ? 0 : gap);
74
+ if (0 === index || nextUsed <= budget) used = nextUsed;
75
+ else {
76
+ isOverflowing = true;
77
+ nextOverflow.push(key);
78
+ }
79
+ });
80
+ }
81
+ setOverflowTabs((prev)=>prev.length === nextOverflow.length && prev.every((key, index)=>key === nextOverflow[index]) ? prev : nextOverflow);
82
+ });
83
+ const recomputeSignature = [
84
+ disabled ? 'disabled' : 'enabled',
85
+ ...tabItems.map((item)=>`${item.key}:${item.hidden ? 1 : 0}`)
86
+ ].join('|');
87
+ useLayoutEffect(()=>{
88
+ recompute();
89
+ }, [
90
+ recomputeSignature
91
+ ]);
92
+ const rafRef = useRef(null);
93
+ useEffect(()=>{
94
+ if (disabled) return;
95
+ const outerWrap = outerWrapRef.current;
96
+ const tabList = tabListRef.current;
97
+ if (!outerWrap || !tabList) return;
98
+ const resizeObserver = new ResizeObserver(()=>{
99
+ rafRef.current = requestAnimationFrame(()=>recompute());
100
+ });
101
+ resizeObserver.observe(outerWrap);
102
+ resizeObserver.observe(tabList);
103
+ return ()=>{
104
+ if (null !== rafRef.current) cancelAnimationFrame(rafRef.current);
105
+ resizeObserver.disconnect();
106
+ };
107
+ }, [
108
+ disabled,
109
+ outerWrapRef,
110
+ tabListRef
111
+ ]);
112
+ const hiddenKeys = new Set(tabItems.filter((item)=>item.hidden).map((item)=>item.key));
113
+ return overflowTabs.filter((key)=>!hiddenKeys.has(key));
114
+ }
115
+ function OverflowMenu({ overflowMenuItems, disabled }) {
116
+ const { t } = useTranslation();
117
+ return /*#__PURE__*/ jsx(TabListOverflowWrap, {
118
+ children: /*#__PURE__*/ jsx(DropdownMenu, {
119
+ items: overflowMenuItems,
120
+ isDisabled: disabled,
121
+ position: "bottom-end",
122
+ size: "sm",
123
+ offset: 4,
124
+ trigger: (triggerProps)=>/*#__PURE__*/ jsx(OverflowMenuTrigger, {
125
+ ...triggerProps,
126
+ variant: "transparent",
127
+ icon: /*#__PURE__*/ jsx(IconEllipsis, {}),
128
+ "aria-label": t('More tabs')
129
+ })
130
+ })
131
+ });
132
+ }
133
+ function BaseTabList({ className, outerWrapStyles, variant = 'flat', ...props }) {
134
+ const outerWrapRef = useRef(null);
135
+ const tabListRef = useRef(null);
136
+ const { rootProps, setTabListState } = useContext(TabsContext);
137
+ const { value, defaultValue, onChange, onSelectionChange, disabled, orientation, size, keyboardActivation = 'manual', ...otherRootProps } = rootProps;
138
+ const ariaProps = {
139
+ selectedKey: value,
140
+ defaultSelectedKey: defaultValue,
141
+ onSelectionChange: (key)=>onSelectionChange?.(String(key)),
142
+ isDisabled: disabled,
143
+ keyboardActivation,
144
+ ...otherRootProps,
145
+ ...props
146
+ };
147
+ const state = useTabListState(ariaProps);
148
+ const { tabListProps } = useTabList({
149
+ orientation,
150
+ ...ariaProps
151
+ }, state, tabListRef);
152
+ useEffect(()=>{
153
+ setTabListState(state);
154
+ }, [
155
+ state.disabledKeys,
156
+ state.selectedItem,
157
+ state.selectedKey,
158
+ props.children
159
+ ]);
160
+ const tabItemsRef = useRef({});
161
+ const overflowTabs = useOverflowTabs({
162
+ outerWrapRef,
163
+ tabListRef,
164
+ tabItemsRef,
165
+ tabItems: props.items,
166
+ disabled: 'horizontal' !== orientation
167
+ });
168
+ const overflowMenuItems = useMemo(()=>{
169
+ const sortedKeys = Array.from(state.collection, (item)=>item.key);
170
+ const sortedOverflowTabs = overflowTabs.toSorted((a, b)=>sortedKeys.indexOf(a) - sortedKeys.indexOf(b));
171
+ return sortedOverflowTabs.flatMap((key)=>{
172
+ const item = state.collection.getItem(key);
173
+ if (!item) return [];
174
+ const itemProps = item.props;
175
+ return {
176
+ key: String(key),
177
+ to: itemProps.to,
178
+ isSelected: state.selectedKey === key,
179
+ onAction: void 0 === itemProps.to ? ()=>state.setSelectedKey(key) : ()=>onChange?.(String(key)),
180
+ label: /*#__PURE__*/ jsx(Flex, {
181
+ align: "center",
182
+ gap: "md",
183
+ children: itemProps.children
184
+ }),
185
+ disabled: itemProps.disabled,
186
+ tooltip: itemProps.tooltip?.title,
187
+ tooltipOptions: itemProps.tooltip,
188
+ textValue: item.textValue
189
+ };
190
+ });
191
+ }, [
192
+ state,
193
+ overflowTabs,
194
+ onChange
195
+ ]);
196
+ return /*#__PURE__*/ jsxs(Container, {
197
+ position: "relative",
198
+ className: className,
199
+ style: outerWrapStyles,
200
+ ref: outerWrapRef,
201
+ children: [
202
+ /*#__PURE__*/ jsx(TabListWrap, {
203
+ ...tabListProps,
204
+ orientation: orientation,
205
+ ref: tabListRef,
206
+ variant: variant,
207
+ children: Array.from(state.collection, (item)=>/*#__PURE__*/ jsx(Tab, {
208
+ item: item,
209
+ state: state,
210
+ orientation: orientation,
211
+ size: size,
212
+ overflowing: 'horizontal' === orientation && overflowTabs.includes(item.key),
213
+ tooltipProps: item.props.tooltip,
214
+ ref: (element)=>{
215
+ tabItemsRef.current[item.key] = element;
216
+ },
217
+ variant: variant
218
+ }, item.key))
219
+ }),
220
+ 'horizontal' === orientation && overflowMenuItems.length > 0 && /*#__PURE__*/ jsx(OverflowMenu, {
221
+ overflowMenuItems: overflowMenuItems,
222
+ disabled: disabled
223
+ })
224
+ ]
225
+ });
226
+ }
227
+ const collectionFactory = (nodes)=>new ListCollection(nodes);
228
+ function TabList({ variant, ...props }) {
229
+ const collection = useCollection(props, collectionFactory);
230
+ const parsedItems = useMemo(()=>Array.from(collection, ({ key, props: itemProps })=>({
231
+ key,
232
+ ...itemProps
233
+ })), [
234
+ collection
235
+ ]);
236
+ const disabledKeys = useMemo(()=>parsedItems.filter((item)=>item.disabled).map((item)=>item.key), [
237
+ parsedItems
238
+ ]);
239
+ return /*#__PURE__*/ jsx(BaseTabList, {
240
+ ...props,
241
+ items: parsedItems,
242
+ disabledKeys: disabledKeys,
243
+ variant: variant,
244
+ children: (item)=>/*#__PURE__*/ createElement(TabListItem, {
245
+ ...item,
246
+ key: item.key
247
+ })
248
+ });
249
+ }
250
+ TabList.Item = TabListItem;
251
+ const TabListWrap = StyledTabListWrap;
252
+ const TabListOverflowWrap = StyledTabListOverflowWrap;
253
+ const OverflowMenuTrigger = styled(OverlayTrigger.IconButton)`
254
+ padding-left: ${(p)=>p.theme.space.md};
255
+ padding-right: ${(p)=>p.theme.space.md};
256
+ color: ${(p)=>p.theme.tokens.interactive.link.neutral.rest};
257
+ `;
258
+ export { TabList };
@@ -0,0 +1,13 @@
1
+ import type { CollectionBase } from '@react-types/shared';
2
+ export interface TabPanelsProps {
3
+ children: CollectionBase<unknown>['children'];
4
+ className?: string;
5
+ }
6
+ /**
7
+ * To be used as a direct child of the <Tabs /> component. See example usage
8
+ * in tabs.stories.js
9
+ */
10
+ export declare function TabPanels(props: TabPanelsProps): import("@emotion/react/jsx-runtime").JSX.Element | null;
11
+ export declare namespace TabPanels {
12
+ var Item: (props: import("./item.js").TabPanelItemProps) => import("react").JSX.Element;
13
+ }
@@ -0,0 +1,62 @@
1
+ import { jsx } from "@emotion/react/jsx-runtime";
2
+ import { createElement, css } from "@emotion/react";
3
+ import { useContext, useRef } from "react";
4
+ import styled from "@emotion/styled";
5
+ import { useTabPanel } from "@react-aria/tabs";
6
+ import { useCollection } from "@react-stately/collections";
7
+ import { ListCollection } from "@react-stately/list";
8
+ import { TabsContext } from "./context.js";
9
+ import { TabPanelItem } from "./item.js";
10
+ import { tabsShouldForwardProp } from "./utils.js";
11
+ const collectionFactory = (nodes)=>new ListCollection(nodes);
12
+ function TabPanels(props) {
13
+ const { rootProps: { orientation, items }, tabListState } = useContext(TabsContext);
14
+ const collection = useCollection({
15
+ items,
16
+ ...props
17
+ }, collectionFactory, {
18
+ suppressTextValueWarning: true
19
+ });
20
+ if (!tabListState) return null;
21
+ const selectedPanel = tabListState.selectedKey ? collection.getItem(tabListState.selectedKey) : null;
22
+ return /*#__PURE__*/ createElement(TabPanel, {
23
+ ...props,
24
+ state: tabListState,
25
+ orientation: orientation,
26
+ key: tabListState?.selectedKey
27
+ }, selectedPanel?.props.children);
28
+ }
29
+ TabPanels.Item = TabPanelItem;
30
+ function TabPanel({ state, orientation = 'horizontal', className, children, ...props }) {
31
+ const ref = useRef(null);
32
+ const { tabPanelProps } = useTabPanel(props, state, ref);
33
+ return /*#__PURE__*/ jsx(TabPanelWrap, {
34
+ ...tabPanelProps,
35
+ orientation: orientation,
36
+ className: className,
37
+ ref: ref,
38
+ children: children
39
+ });
40
+ }
41
+ const TabPanelWrap = styled('div', {
42
+ shouldForwardProp: tabsShouldForwardProp
43
+ })`
44
+ border-radius: ${(p)=>p.theme.radius.md};
45
+
46
+ ${(p)=>'horizontal' === p.orientation ? css`
47
+ height: 100%;
48
+ padding-top: ${p.theme.space.md};
49
+ ` : css`
50
+ width: 100%;
51
+ padding-left: ${p.theme.space.md};
52
+ `}
53
+
54
+ &:focus-visible {
55
+ outline: none;
56
+ box-shadow:
57
+ inset ${(p)=>p.theme.tokens.focus.default} 0 0 0 1px,
58
+ ${(p)=>p.theme.tokens.focus.default} 0 0 0 1px;
59
+ z-index: 1;
60
+ }
61
+ `;
62
+ export { TabPanels };
@@ -0,0 +1,53 @@
1
+ import type { JSX, ReactNode } from 'react';
2
+ import type { AriaTabListOptions } from '@react-aria/tabs';
3
+ import type { TabListStateOptions } from '@react-stately/tabs';
4
+ import type { LinkTabListItemProps, TabListItemProps, TabPanelItemProps } from './item.js';
5
+ import type { TabProps } from './tab.js';
6
+ import { type TabListProps } from './tabList.js';
7
+ import { type TabPanelsProps } from './tabPanels.js';
8
+ export type TabKey = string;
9
+ interface Components<T extends TabKey, I> {
10
+ TabList: {
11
+ (props: TabListProps): JSX.Element;
12
+ Item: (props: I) => JSX.Element;
13
+ };
14
+ TabPanels: {
15
+ (props: TabPanelsProps): JSX.Element | null;
16
+ Item: (props: TabPanelItemProps<T>) => JSX.Element;
17
+ };
18
+ }
19
+ export type TabsComponents<T extends TabKey> = Components<T, TabListItemProps<T>>;
20
+ export type LinkTabsComponents<T extends TabKey> = Components<T, LinkTabListItemProps<T>>;
21
+ interface BaseTabsProps extends Omit<AriaTabListOptions<any>, 'selectedKey' | 'defaultSelectedKey' | 'onSelectionChange' | 'isDisabled' | 'disabledKeys'>, Omit<TabListStateOptions<any>, 'children' | 'selectedKey' | 'defaultSelectedKey' | 'onSelectionChange' | 'isDisabled' | 'disabledKeys'> {
22
+ className?: string;
23
+ disabled?: boolean;
24
+ size?: TabProps['size'];
25
+ }
26
+ type SelectionProps<T extends TabKey> = {
27
+ onChange: (key: NoInfer<T>) => void;
28
+ value: T;
29
+ defaultValue?: never;
30
+ } | {
31
+ defaultValue: NoInfer<T>;
32
+ onChange?: (key: T) => void;
33
+ value?: never;
34
+ };
35
+ export type TabsProps<T extends TabKey = TabKey> = BaseTabsProps & SelectionProps<T> & {
36
+ children: (components: TabsComponents<NoInfer<T>>) => ReactNode;
37
+ disabledKeys?: Iterable<NoInfer<T>>;
38
+ };
39
+ export type LinkTabsProps<T extends TabKey = TabKey> = Omit<BaseTabsProps, 'keyboardActivation'> & {
40
+ children: (components: LinkTabsComponents<NoInfer<T>>) => ReactNode;
41
+ value: T;
42
+ defaultValue?: never;
43
+ disabledKeys?: Iterable<NoInfer<T>>;
44
+ /** Reports link activation, including modified clicks, rather than selection or URL changes. */
45
+ onChange?: (key: NoInfer<T>) => void;
46
+ };
47
+ export type InternalTabsProps = Omit<TabsProps, 'children'> & {
48
+ children: ReactNode;
49
+ onSelectionChange?: (key: TabKey) => void;
50
+ };
51
+ export declare const Tabs: <T extends TabKey = TabKey>(props: TabsProps<T>) => JSX.Element;
52
+ export declare const LinkTabs: <T extends TabKey = TabKey>(props: LinkTabsProps<T>) => JSX.Element;
53
+ export {};
@@ -0,0 +1,59 @@
1
+ import { jsx } from "@emotion/react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { Flex } from "../layout/index.js";
4
+ import { TabsContext } from "./context.js";
5
+ import { TabList } from "./tabList.js";
6
+ import { TabPanels } from "./tabPanels.js";
7
+ function TabStateProvider({ children, orientation = 'horizontal', size = 'md', ...props }) {
8
+ const [tabListState, setTabListState] = useState();
9
+ return /*#__PURE__*/ jsx(TabsContext, {
10
+ value: {
11
+ rootProps: {
12
+ orientation,
13
+ size,
14
+ ...props
15
+ },
16
+ tabListState,
17
+ setTabListState
18
+ },
19
+ children: children
20
+ });
21
+ }
22
+ const components = {
23
+ TabList: TabList,
24
+ TabPanels: TabPanels
25
+ };
26
+ function TabsRoot({ children, className, orientation = 'horizontal', ...props }) {
27
+ return /*#__PURE__*/ jsx(TabStateProvider, {
28
+ orientation: orientation,
29
+ ...props,
30
+ children: /*#__PURE__*/ jsx(Flex, {
31
+ className: className,
32
+ direction: 'horizontal' === orientation ? 'column' : 'row',
33
+ flexGrow: 1,
34
+ minWidth: "0",
35
+ flexBasis: 'horizontal' === orientation ? '0' : 'auto',
36
+ alignSelf: 'horizontal' === orientation ? 'stretch' : 'auto',
37
+ height: 'vertical' === orientation ? '100%' : void 0,
38
+ align: 'vertical' === orientation ? 'stretch' : void 0,
39
+ children: children
40
+ })
41
+ });
42
+ }
43
+ function SelectionTabsRoot({ children, onChange, ...props }) {
44
+ return /*#__PURE__*/ jsx(TabsRoot, {
45
+ ...props,
46
+ onSelectionChange: onChange,
47
+ children: children(components)
48
+ });
49
+ }
50
+ function LinkTabsRoot({ children, ...props }) {
51
+ return /*#__PURE__*/ jsx(TabsRoot, {
52
+ ...props,
53
+ keyboardActivation: "manual",
54
+ children: children(components)
55
+ });
56
+ }
57
+ const Tabs = SelectionTabsRoot;
58
+ const LinkTabs = LinkTabsRoot;
59
+ export { LinkTabs, Tabs };
@@ -0,0 +1,3 @@
1
+ import type { MouseEvent, PointerEvent } from 'react';
2
+ export declare const tabsShouldForwardProp: (prop: string) => boolean;
3
+ export declare function isModifiedClick(event: MouseEvent | PointerEvent): boolean;
@@ -0,0 +1,6 @@
1
+ import is_prop_valid from "@emotion/is-prop-valid";
2
+ const tabsShouldForwardProp = (prop)=>'string' == typeof prop && is_prop_valid(prop) && 'orientation' !== prop;
3
+ function isModifiedClick(event) {
4
+ return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || 0 !== event.button;
5
+ }
6
+ export { isModifiedClick, tabsShouldForwardProp };