@sentry/scraps 0.5.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 (103) hide show
  1. package/README.md +68 -3
  2. package/dist/badge/tag.js +4 -2
  3. package/dist/button/button.js +1 -0
  4. package/dist/button/linkButton.js +1 -0
  5. package/dist/button/styles.js +157 -152
  6. package/dist/codeBlock/codeBlock.js +1 -0
  7. package/dist/compactSelect/control.js +3 -2
  8. package/dist/compactSelect/utils.js +2 -6
  9. package/dist/dateTime/config.d.ts +23 -0
  10. package/dist/dateTime/config.js +50 -0
  11. package/dist/dateTime/context.d.ts +18 -0
  12. package/dist/dateTime/context.js +46 -0
  13. package/dist/dateTime/dateTime.d.ts +6 -0
  14. package/dist/dateTime/dateTime.js +30 -0
  15. package/dist/dateTime/format.d.ts +24 -0
  16. package/dist/dateTime/format.js +45 -0
  17. package/dist/dateTime/index.d.ts +6 -0
  18. package/dist/dateTime/index.js +6 -0
  19. package/dist/dateTime/intlFormatter.d.ts +9 -0
  20. package/dist/dateTime/intlFormatter.js +16 -0
  21. package/dist/dateTime/parseDate.d.ts +3 -0
  22. package/dist/dateTime/parseDate.js +12 -0
  23. package/dist/dropdownMenu/context.d.ts +28 -13
  24. package/dist/dropdownMenu/dropdownMenu.d.ts +2 -2
  25. package/dist/dropdownMenu/dropdownMenu.js +9 -3
  26. package/dist/dropdownMenu/item.d.ts +6 -2
  27. package/dist/dropdownMenu/item.js +31 -71
  28. package/dist/dropdownMenu/list.d.ts +31 -5
  29. package/dist/dropdownMenu/list.js +143 -124
  30. package/dist/dropdownMenu/useDropdownMenuKeyboard.d.ts +5 -241
  31. package/dist/dropdownMenu/useDropdownMenuKeyboard.js +5 -29
  32. package/dist/dropdownMenu/useDropdownRootMenuState.d.ts +13 -0
  33. package/dist/dropdownMenu/useDropdownRootMenuState.js +30 -0
  34. package/dist/dropdownMenu/useDropdownSubmenuState.d.ts +19 -0
  35. package/dist/dropdownMenu/useDropdownSubmenuState.js +25 -0
  36. package/dist/dropdownMenu/utils.js +5 -7
  37. package/dist/duration/formatElapsedDuration.d.ts +4 -0
  38. package/dist/duration/formatElapsedDuration.js +10 -0
  39. package/dist/duration/getDuration.d.ts +68 -0
  40. package/dist/duration/getDuration.js +80 -0
  41. package/dist/duration/index.d.ts +2 -0
  42. package/dist/duration/index.js +2 -0
  43. package/dist/{compactSelect/fzf.d.ts → fzf.d.ts} +1 -0
  44. package/dist/{compactSelect/fzf.js → fzf.js} +5 -1
  45. package/dist/layout/container.d.ts +8 -2
  46. package/dist/layout/container.js +2 -2
  47. package/dist/layout/styles.d.ts +2 -1
  48. package/dist/layout/styles.js +11 -5
  49. package/dist/legacyDatetime.d.ts +21 -0
  50. package/dist/legacyDatetime.js +13 -0
  51. package/dist/link/index.d.ts +1 -1
  52. package/dist/link/index.js +1 -1
  53. package/dist/link/linkBehaviorContext.d.ts +9 -0
  54. package/dist/link/linkBehaviorContext.js +37 -7
  55. package/dist/menu/menu.d.ts +1 -3
  56. package/dist/menu/menu.js +4 -5
  57. package/dist/relativeTime/getRelativeDate.d.ts +14 -0
  58. package/dist/relativeTime/getRelativeDate.js +107 -0
  59. package/dist/relativeTime/index.d.ts +3 -0
  60. package/dist/relativeTime/index.js +3 -0
  61. package/dist/relativeTime/relativeTime.d.ts +55 -0
  62. package/dist/relativeTime/relativeTime.js +102 -0
  63. package/dist/relativeTime/useRelativeTimeFormatter.d.ts +2 -0
  64. package/dist/relativeTime/useRelativeTimeFormatter.js +10 -0
  65. package/dist/tabs/context.d.ts +9 -0
  66. package/dist/tabs/context.js +9 -0
  67. package/dist/tabs/index.d.ts +2 -4
  68. package/dist/tabs/index.js +1 -3
  69. package/dist/tabs/item.d.ts +16 -5
  70. package/dist/tabs/tab.js +6 -3
  71. package/dist/tabs/tabList.d.ts +5 -5
  72. package/dist/tabs/tabList.js +8 -6
  73. package/dist/tabs/tabPanels.d.ts +2 -3
  74. package/dist/tabs/tabPanels.js +1 -1
  75. package/dist/tabs/tabs.d.ts +46 -31
  76. package/dist/tabs/tabs.js +38 -35
  77. package/dist/text/prose.d.ts +2 -2
  78. package/dist/theme/theme.d.ts +34 -34
  79. package/dist/theme/theme.js +9 -0
  80. package/dist/theme/types.d.ts +20 -2
  81. package/dist/translation/index.d.ts +1 -0
  82. package/dist/translation/index.js +1 -0
  83. package/dist/translation/translate.d.ts +9 -0
  84. package/dist/translation/translate.js +5 -0
  85. package/dist/translation/translationContext.d.ts +2 -1
  86. package/dist/translation/translationContext.js +2 -1
  87. package/fonts/OFL.txt +94 -0
  88. package/fonts/roboto-mono-variable-cyrillic-ext.woff2 +0 -0
  89. package/fonts/roboto-mono-variable-cyrillic.woff2 +0 -0
  90. package/fonts/roboto-mono-variable-greek.woff2 +0 -0
  91. package/fonts/roboto-mono-variable-latin-ext.woff2 +0 -0
  92. package/fonts/roboto-mono-variable-vietnamese.woff2 +0 -0
  93. package/fonts/roboto-mono-variable.woff2 +0 -0
  94. package/fonts/rubik-variable-cyrillic-ext.woff2 +0 -0
  95. package/fonts/rubik-variable-cyrillic.woff2 +0 -0
  96. package/fonts/rubik-variable-latin-ext.woff2 +0 -0
  97. package/fonts/rubik-variable.woff2 +0 -0
  98. package/fonts.css +211 -0
  99. package/package.json +30 -12
  100. package/dist/datetime.d.ts +0 -39
  101. package/dist/datetime.js +0 -20
  102. package/dist/dropdownMenu/useSafetyTriangle.d.ts +0 -12
  103. package/dist/dropdownMenu/useSafetyTriangle.js +0 -119
@@ -1,3 +1 @@
1
- export { TabStateProvider, Tabs } from "./tabs.js";
2
- export { TabList } from "./tabList.js";
3
- export { TabPanels } from "./tabPanels.js";
1
+ export { LinkTabs, Tabs } from "./tabs.js";
@@ -2,12 +2,23 @@ import type { JSX } from 'react';
2
2
  import type { ItemProps } from '@react-types/shared';
3
3
  import type { LinkProps } from '../link/index.js';
4
4
  import type { TooltipProps } from '../tooltip/index.js';
5
- export interface TabListItemProps extends ItemProps<any> {
6
- key: string | number;
5
+ import type { TabKey } from './tabs.js';
6
+ interface BaseTabListItemProps<T extends TabKey> extends ItemProps<any> {
7
+ key: T;
7
8
  disabled?: boolean;
8
9
  hidden?: boolean;
9
- to?: LinkProps['to'];
10
10
  tooltip?: TooltipProps;
11
11
  }
12
- export declare const TabListItem: (props: TabListItemProps) => JSX.Element;
13
- export declare const TabPanelItem: (props: ItemProps<any>) => JSX.Element;
12
+ export interface TabListItemProps<T extends TabKey = TabKey> extends BaseTabListItemProps<T> {
13
+ to?: never;
14
+ }
15
+ export interface LinkTabListItemProps<T extends TabKey = TabKey> extends BaseTabListItemProps<T> {
16
+ to: NonNullable<LinkProps['to']>;
17
+ }
18
+ export type InternalTabListItemProps = TabListItemProps | LinkTabListItemProps;
19
+ export interface TabPanelItemProps<T extends TabKey = TabKey> extends ItemProps<any> {
20
+ key: T;
21
+ }
22
+ export declare const TabListItem: (props: InternalTabListItemProps) => JSX.Element;
23
+ export declare const TabPanelItem: (props: TabPanelItemProps) => JSX.Element;
24
+ export {};
package/dist/tabs/tab.js CHANGED
@@ -1,11 +1,12 @@
1
1
  import { jsx, jsxs } from "@emotion/react/jsx-runtime";
2
- import { Fragment, useRef } from "react";
2
+ import { Fragment, useContext, useRef } from "react";
3
3
  import { css } from "@emotion/react";
4
4
  import styled from "@emotion/styled";
5
5
  import { useTab } from "@react-aria/tabs";
6
6
  import { useObjectRef } from "@react-aria/utils";
7
7
  import { Link } from "../link/index.js";
8
8
  import { Tooltip } from "../tooltip/index.js";
9
+ import { TabsContext } from "./context.js";
9
10
  import { isModifiedClick, tabsShouldForwardProp } from "./utils.js";
10
11
  const StyledTabWrap = styled('li', {
11
12
  shouldForwardProp: tabsShouldForwardProp
@@ -110,15 +111,16 @@ const StyledTabSelectionIndicator = styled('div')`
110
111
  `}
111
112
  `;
112
113
  function Tab({ ref, item, state, orientation, overflowing, variant = 'flat', size, as = 'li', tooltipProps }) {
114
+ const { rootProps: { onChange } } = useContext(TabsContext);
113
115
  const wrapperRef = useObjectRef(ref);
114
116
  const controlRef = useRef(null);
115
117
  const { key, rendered, props: { to, hidden } } = item;
116
118
  const { tabProps, isSelected, isDisabled } = useTab({
117
119
  key,
118
120
  isDisabled: hidden,
119
- shouldSelectOnPressUp: !!to
121
+ shouldSelectOnPressUp: void 0 !== to
120
122
  }, state, controlRef);
121
- const isLink = !!to && !isDisabled;
123
+ const isLink = void 0 !== to && !isDisabled;
122
124
  const styleProps = {
123
125
  orientation,
124
126
  variant,
@@ -161,6 +163,7 @@ function Tab({ ref, item, state, orientation, overflowing, variant = 'flat', siz
161
163
  if (!isModifiedClick(event)) tabProps.onPointerDown?.(event);
162
164
  },
163
165
  onClick: (event)=>{
166
+ onChange?.(String(key));
164
167
  if (!isModifiedClick(event)) tabProps.onClick?.(event);
165
168
  },
166
169
  onKeyDown: (event)=>{
@@ -1,9 +1,10 @@
1
1
  import type { CSSProperties } from 'react';
2
2
  import type { TabListStateOptions } from '@react-stately/tabs';
3
- import type { TabListItemProps } from './item.js';
3
+ import type { InternalTabListItemProps } from './item.js';
4
4
  import type { TabProps } from './tab.js';
5
- interface TabListProps {
6
- children: TabListStateOptions<TabListItemProps>['children'];
5
+ export interface TabListProps {
6
+ children: TabListStateOptions<InternalTabListItemProps>['children'];
7
+ className?: string;
7
8
  outerWrapStyles?: CSSProperties;
8
9
  variant?: TabProps['variant'];
9
10
  }
@@ -13,6 +14,5 @@ interface TabListProps {
13
14
  */
14
15
  export declare function TabList({ variant, ...props }: TabListProps): import("@emotion/react/jsx-runtime").JSX.Element;
15
16
  export declare namespace TabList {
16
- var Item: (props: TabListItemProps) => import("react").JSX.Element;
17
+ var Item: (props: InternalTabListItemProps) => import("react").JSX.Element;
17
18
  }
18
- export {};
@@ -11,9 +11,9 @@ import { DropdownMenu } from "../dropdownMenu/index.js";
11
11
  import { Container, Flex } from "../layout/index.js";
12
12
  import { OverlayTrigger } from "../overlayTrigger.js";
13
13
  import { useTranslation } from "../translation/useTranslation.js";
14
+ import { TabsContext } from "./context.js";
14
15
  import { TabListItem } from "./item.js";
15
16
  import { Tab } from "./tab.js";
16
- import { TabsContext } from "./tabs.js";
17
17
  import { tabsShouldForwardProp } from "./utils.js";
18
18
  const StyledTabListWrap = styled('ul', {
19
19
  shouldForwardProp: tabsShouldForwardProp
@@ -130,15 +130,15 @@ function OverflowMenu({ overflowMenuItems, disabled }) {
130
130
  })
131
131
  });
132
132
  }
133
- function BaseTabList({ outerWrapStyles, variant = 'flat', ...props }) {
133
+ function BaseTabList({ className, outerWrapStyles, variant = 'flat', ...props }) {
134
134
  const outerWrapRef = useRef(null);
135
135
  const tabListRef = useRef(null);
136
136
  const { rootProps, setTabListState } = useContext(TabsContext);
137
- const { value, defaultValue, onChange, disabled, orientation, size, keyboardActivation = 'manual', ...otherRootProps } = rootProps;
137
+ const { value, defaultValue, onChange, onSelectionChange, disabled, orientation, size, keyboardActivation = 'manual', ...otherRootProps } = rootProps;
138
138
  const ariaProps = {
139
139
  selectedKey: value,
140
140
  defaultSelectedKey: defaultValue,
141
- onSelectionChange: onChange,
141
+ onSelectionChange: (key)=>onSelectionChange?.(String(key)),
142
142
  isDisabled: disabled,
143
143
  keyboardActivation,
144
144
  ...otherRootProps,
@@ -176,7 +176,7 @@ function BaseTabList({ outerWrapStyles, variant = 'flat', ...props }) {
176
176
  key: String(key),
177
177
  to: itemProps.to,
178
178
  isSelected: state.selectedKey === key,
179
- onAction: itemProps.to ? void 0 : ()=>state.setSelectedKey(key),
179
+ onAction: void 0 === itemProps.to ? ()=>state.setSelectedKey(key) : ()=>onChange?.(String(key)),
180
180
  label: /*#__PURE__*/ jsx(Flex, {
181
181
  align: "center",
182
182
  gap: "md",
@@ -190,10 +190,12 @@ function BaseTabList({ outerWrapStyles, variant = 'flat', ...props }) {
190
190
  });
191
191
  }, [
192
192
  state,
193
- overflowTabs
193
+ overflowTabs,
194
+ onChange
194
195
  ]);
195
196
  return /*#__PURE__*/ jsxs(Container, {
196
197
  position: "relative",
198
+ className: className,
197
199
  style: outerWrapStyles,
198
200
  ref: outerWrapRef,
199
201
  children: [
@@ -1,5 +1,5 @@
1
1
  import type { CollectionBase } from '@react-types/shared';
2
- interface TabPanelsProps {
2
+ export interface TabPanelsProps {
3
3
  children: CollectionBase<unknown>['children'];
4
4
  className?: string;
5
5
  }
@@ -9,6 +9,5 @@ interface TabPanelsProps {
9
9
  */
10
10
  export declare function TabPanels(props: TabPanelsProps): import("@emotion/react/jsx-runtime").JSX.Element | null;
11
11
  export declare namespace TabPanels {
12
- var Item: (props: import("@react-types/shared").ItemProps<any>) => import("react").JSX.Element;
12
+ var Item: (props: import("./item.js").TabPanelItemProps) => import("react").JSX.Element;
13
13
  }
14
- export {};
@@ -5,8 +5,8 @@ import styled from "@emotion/styled";
5
5
  import { useTabPanel } from "@react-aria/tabs";
6
6
  import { useCollection } from "@react-stately/collections";
7
7
  import { ListCollection } from "@react-stately/list";
8
+ import { TabsContext } from "./context.js";
8
9
  import { TabPanelItem } from "./item.js";
9
- import { TabsContext } from "./tabs.js";
10
10
  import { tabsShouldForwardProp } from "./utils.js";
11
11
  const collectionFactory = (nodes)=>new ListCollection(nodes);
12
12
  function TabPanels(props) {
@@ -1,38 +1,53 @@
1
- import type { ReactNode } from 'react';
1
+ import type { JSX, ReactNode } from 'react';
2
2
  import type { AriaTabListOptions } from '@react-aria/tabs';
3
- import type { TabListState, TabListStateOptions } from '@react-stately/tabs';
3
+ import type { TabListStateOptions } from '@react-stately/tabs';
4
+ import type { LinkTabListItemProps, TabListItemProps, TabPanelItemProps } from './item.js';
4
5
  import type { TabProps } from './tab.js';
5
- interface TabsProps<T> extends Omit<AriaTabListOptions<any>, 'selectedKey' | 'defaultSelectedKey' | 'onSelectionChange' | 'isDisabled'>, Omit<TabListStateOptions<any>, 'children' | 'selectedKey' | 'defaultSelectedKey' | 'onSelectionChange' | 'isDisabled'> {
6
- children?: ReactNode;
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'> {
7
22
  className?: string;
8
- /**
9
- * [Uncontrolled] Default selected tab. Must match the `key` prop on the
10
- * selected tab item.
11
- */
12
- defaultValue?: T;
13
23
  disabled?: boolean;
14
- /**
15
- * Callback when the selected tab changes.
16
- */
17
- onChange?: (key: T) => void;
18
24
  size?: TabProps['size'];
19
- /**
20
- * [Controlled] Selected tab. Must match the `key` prop on the selected tab
21
- * item.
22
- */
23
- value?: T;
24
25
  }
25
- interface TabContext {
26
- rootProps: Omit<TabsProps<any>, 'children' | 'className' | 'orientation' | 'size'> & Required<Pick<TabsProps<any>, 'orientation' | 'size'>>;
27
- setTabListState: (state: TabListState<any>) => void;
28
- tabListState?: TabListState<any>;
29
- }
30
- export declare const TabsContext: import("react").Context<TabContext>;
31
- export declare function TabStateProvider<T extends string | number>({ children, ...props }: Omit<TabsProps<T>, 'className'>): import("@emotion/react/jsx-runtime").JSX.Element;
32
- /**
33
- * Root tabs component. Provides the necessary data (via React context) for
34
- * child components (TabList and TabPanels) to work together. See example
35
- * usage in tabs.stories.js
36
- */
37
- export declare function Tabs<T extends string | number>({ orientation, size, className, children, ...props }: TabsProps<T>): import("@emotion/react/jsx-runtime").JSX.Element;
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;
38
53
  export {};
package/dist/tabs/tabs.js CHANGED
@@ -1,22 +1,16 @@
1
1
  import { jsx } from "@emotion/react/jsx-runtime";
2
- import { createContext, useState } from "react";
3
- import { css } from "@emotion/react";
4
- import styled from "@emotion/styled";
5
- import { tabsShouldForwardProp } from "./utils.js";
6
- const TabsContext = /*#__PURE__*/ createContext({
7
- rootProps: {
8
- orientation: 'horizontal',
9
- size: 'md'
10
- },
11
- setTabListState: ()=>{}
12
- });
13
- function TabStateProvider({ children, ...props }) {
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 }) {
14
8
  const [tabListState, setTabListState] = useState();
15
9
  return /*#__PURE__*/ jsx(TabsContext, {
16
10
  value: {
17
11
  rootProps: {
18
- orientation: 'horizontal',
19
- size: 'md',
12
+ orientation,
13
+ size,
20
14
  ...props
21
15
  },
22
16
  tabListState,
@@ -25,32 +19,41 @@ function TabStateProvider({ children, ...props }) {
25
19
  children: children
26
20
  });
27
21
  }
28
- function Tabs({ orientation = 'horizontal', size = 'md', className, children, ...props }) {
22
+ const components = {
23
+ TabList: TabList,
24
+ TabPanels: TabPanels
25
+ };
26
+ function TabsRoot({ children, className, orientation = 'horizontal', ...props }) {
29
27
  return /*#__PURE__*/ jsx(TabStateProvider, {
30
28
  orientation: orientation,
31
- size: size,
32
29
  ...props,
33
- children: /*#__PURE__*/ jsx(TabsWrap, {
34
- orientation: orientation,
30
+ children: /*#__PURE__*/ jsx(Flex, {
35
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,
36
39
  children: children
37
40
  })
38
41
  });
39
42
  }
40
- const TabsWrap = styled('div', {
41
- shouldForwardProp: tabsShouldForwardProp
42
- })`
43
- display: flex;
44
- flex-direction: ${(p)=>'horizontal' === p.orientation ? 'column' : 'row'};
45
- flex-grow: 1;
46
- min-width: 0;
47
- /* Let horizontal tabs share a wrapping row and fill a column layout. */
48
- flex-basis: ${(p)=>'horizontal' === p.orientation ? '0' : 'auto'};
49
- align-self: ${(p)=>'horizontal' === p.orientation ? 'stretch' : 'auto'};
50
-
51
- ${(p)=>'vertical' === p.orientation && css`
52
- height: 100%;
53
- align-items: stretch;
54
- `}
55
- `;
56
- export { TabStateProvider, Tabs, TabsContext };
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 };
@@ -2,7 +2,7 @@ import type * as React from 'react';
2
2
  export declare const Prose: import("@emotion/styled").StyledComponent<{
3
3
  as?: keyof HTMLElementTagNameMap | undefined;
4
4
  children?: React.ReactNode;
5
- ref?: React.Ref<HTMLDivElement | HTMLElement | HTMLObjectElement | HTMLDialogElement | HTMLProgressElement | HTMLStyleElement | HTMLLinkElement | HTMLMapElement | HTMLAnchorElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBodyElement | HTMLBRElement | HTMLButtonElement | HTMLCanvasElement | HTMLTableColElement | HTMLDataElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLFormElement | HTMLHeadingElement | HTMLHeadElement | HTMLHRElement | HTMLHtmlElement | HTMLIFrameElement | HTMLImageElement | HTMLInputElement | HTMLLabelElement | HTMLLegendElement | HTMLLIElement | HTMLMetaElement | HTMLMeterElement | HTMLOListElement | HTMLOptGroupElement | HTMLOptionElement | HTMLOutputElement | HTMLParagraphElement | HTMLPreElement | HTMLSlotElement | HTMLScriptElement | HTMLSelectElement | HTMLSourceElement | HTMLSpanElement | HTMLTableElement | HTMLTemplateElement | HTMLTableSectionElement | HTMLTableCellElement | HTMLTextAreaElement | HTMLTimeElement | HTMLTitleElement | HTMLTableRowElement | HTMLTrackElement | HTMLUListElement | HTMLVideoElement | HTMLTableCaptionElement | HTMLMenuElement | HTMLPictureElement | null> | undefined;
6
- } & React.HTMLAttributes<HTMLDivElement | HTMLElement | HTMLObjectElement | HTMLDialogElement | HTMLProgressElement | HTMLStyleElement | HTMLLinkElement | HTMLMapElement | HTMLAnchorElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBodyElement | HTMLBRElement | HTMLButtonElement | HTMLCanvasElement | HTMLTableColElement | HTMLDataElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLFormElement | HTMLHeadingElement | HTMLHeadElement | HTMLHRElement | HTMLHtmlElement | HTMLIFrameElement | HTMLImageElement | HTMLInputElement | HTMLLabelElement | HTMLLegendElement | HTMLLIElement | HTMLMetaElement | HTMLMeterElement | HTMLOListElement | HTMLOptGroupElement | HTMLOptionElement | HTMLOutputElement | HTMLParagraphElement | HTMLPreElement | HTMLSlotElement | HTMLScriptElement | HTMLSelectElement | HTMLSourceElement | HTMLSpanElement | HTMLTableElement | HTMLTemplateElement | HTMLTableSectionElement | HTMLTableCellElement | HTMLTextAreaElement | HTMLTimeElement | HTMLTitleElement | HTMLTableRowElement | HTMLTrackElement | HTMLUListElement | HTMLVideoElement | HTMLTableCaptionElement | HTMLMenuElement | HTMLPictureElement> & {
5
+ ref?: React.Ref<HTMLTimeElement | HTMLElement | HTMLDivElement | HTMLObjectElement | HTMLDialogElement | HTMLProgressElement | HTMLStyleElement | HTMLAnchorElement | HTMLMapElement | HTMLLinkElement | HTMLSlotElement | HTMLTitleElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBodyElement | HTMLBRElement | HTMLButtonElement | HTMLCanvasElement | HTMLTableColElement | HTMLDataElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLFormElement | HTMLHeadingElement | HTMLHeadElement | HTMLHRElement | HTMLHtmlElement | HTMLIFrameElement | HTMLImageElement | HTMLInputElement | HTMLLabelElement | HTMLLegendElement | HTMLLIElement | HTMLMetaElement | HTMLMeterElement | HTMLOListElement | HTMLOptGroupElement | HTMLOptionElement | HTMLOutputElement | HTMLParagraphElement | HTMLPreElement | HTMLScriptElement | HTMLSelectElement | HTMLSourceElement | HTMLSpanElement | HTMLTableElement | HTMLTemplateElement | HTMLTableSectionElement | HTMLTableCellElement | HTMLTextAreaElement | HTMLTableRowElement | HTMLTrackElement | HTMLUListElement | HTMLVideoElement | HTMLTableCaptionElement | HTMLMenuElement | HTMLPictureElement | null> | undefined;
6
+ } & React.HTMLAttributes<HTMLTimeElement | HTMLElement | HTMLDivElement | HTMLObjectElement | HTMLDialogElement | HTMLProgressElement | HTMLStyleElement | HTMLAnchorElement | HTMLMapElement | HTMLLinkElement | HTMLSlotElement | HTMLTitleElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBodyElement | HTMLBRElement | HTMLButtonElement | HTMLCanvasElement | HTMLTableColElement | HTMLDataElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLFormElement | HTMLHeadingElement | HTMLHeadElement | HTMLHRElement | HTMLHtmlElement | HTMLIFrameElement | HTMLImageElement | HTMLInputElement | HTMLLabelElement | HTMLLegendElement | HTMLLIElement | HTMLMetaElement | HTMLMeterElement | HTMLOListElement | HTMLOptGroupElement | HTMLOptionElement | HTMLOutputElement | HTMLParagraphElement | HTMLPreElement | HTMLScriptElement | HTMLSelectElement | HTMLSourceElement | HTMLSpanElement | HTMLTableElement | HTMLTemplateElement | HTMLTableSectionElement | HTMLTableCellElement | HTMLTextAreaElement | HTMLTableRowElement | HTMLTrackElement | HTMLUListElement | HTMLVideoElement | HTMLTableCaptionElement | HTMLMenuElement | HTMLPictureElement> & {
7
7
  theme?: import("@emotion/react").Theme;
8
8
  }, {}, {}>;
@@ -14,9 +14,9 @@ import { lightTheme as baseLightTheme } from './light.js';
14
14
  import { type Swatch } from './swatch.js';
15
15
  import type { MotionDuration } from './types.js';
16
16
  type MotionDefinition = Record<MotionDuration, string>;
17
- type ScrapsTheme = {
17
+ type ScrapsTheme = Omit<{
18
18
  [Key in keyof typeof baseLightTheme]: (typeof baseLightTheme)[Key] | (typeof baseDarkTheme)[Key];
19
- };
19
+ }, 'font'>;
20
20
  export interface SentryTheme extends ScrapsTheme, Omit<typeof lightThemeDefinition, keyof ScrapsTheme | 'chart'> {
21
21
  chart: {
22
22
  getColorPalette: ReturnType<typeof makeChartColorPalette>;
@@ -115,6 +115,38 @@ declare const lightThemeDefinition: {
115
115
  };
116
116
  };
117
117
  visuallyHidden: import("@emotion/react").SerializedStyles;
118
+ font: {
119
+ readonly family: {
120
+ readonly sans: "Rubik, 'scraps-fallback-sans', 'Avenir Next', sans-serif";
121
+ readonly mono: "'Roboto Mono', 'scraps-fallback-mono', Monaco, Consolas, 'Courier New', monospace";
122
+ };
123
+ readonly size: {
124
+ xs: "11px";
125
+ sm: "12px";
126
+ md: "14px";
127
+ lg: "16px";
128
+ xl: "20px";
129
+ '2xl': "24px";
130
+ '3xl': "32px";
131
+ '4xl': "40px";
132
+ };
133
+ readonly weight: {
134
+ sans: {
135
+ regular: 400;
136
+ medium: 500;
137
+ };
138
+ mono: {
139
+ regular: 425;
140
+ medium: 500;
141
+ };
142
+ };
143
+ readonly lineHeight: {
144
+ compressed: 1;
145
+ default: 1.2;
146
+ comfortable: 1.4;
147
+ fixed: "1rem";
148
+ };
149
+ };
118
150
  focusRing: (baseShadow?: string) => {
119
151
  outline: string;
120
152
  boxShadow: string;
@@ -451,38 +483,6 @@ declare const lightThemeDefinition: {
451
483
  };
452
484
  };
453
485
  };
454
- font: {
455
- size: {
456
- xs: "11px";
457
- sm: "12px";
458
- md: "14px";
459
- lg: "16px";
460
- xl: "20px";
461
- '2xl': "24px";
462
- '3xl': "32px";
463
- '4xl': "40px";
464
- };
465
- weight: {
466
- sans: {
467
- regular: 400;
468
- medium: 500;
469
- };
470
- mono: {
471
- regular: 425;
472
- medium: 500;
473
- };
474
- };
475
- family: {
476
- sans: "Rubik, 'Avenir Next', sans-serif";
477
- mono: "'Roboto Mono', Monaco, Consolas, 'Courier New', monospace";
478
- };
479
- lineHeight: {
480
- compressed: 1;
481
- default: 1.2;
482
- comfortable: 1.4;
483
- fixed: "1rem";
484
- };
485
- };
486
486
  space: {
487
487
  '0': "0px";
488
488
  '2xs': "2px";
@@ -195,6 +195,13 @@ const commonTheme = {
195
195
  },
196
196
  ...typography
197
197
  };
198
+ const font = {
199
+ ...typography.font,
200
+ family: {
201
+ sans: "Rubik, 'scraps-fallback-sans', 'Avenir Next', sans-serif",
202
+ mono: "'Roboto Mono', 'scraps-fallback-mono', Monaco, Consolas, 'Courier New', monospace"
203
+ }
204
+ };
198
205
  const ccl = color.categorical.light;
199
206
  const CHART_PALETTE_LIGHT = [
200
207
  [
@@ -744,6 +751,7 @@ const lightThemeDefinition = {
744
751
  type: 'light',
745
752
  ...commonTheme,
746
753
  ...lightTheme,
754
+ font,
747
755
  focusRing: (baseShadow = `0 0 0 0 ${lightTheme.tokens.background.primary}`)=>({
748
756
  outline: 'none',
749
757
  boxShadow: `${baseShadow}, 0 0 0 2px ${lightTheme.tokens.focus["default"]}`
@@ -763,6 +771,7 @@ const theme_darkTheme = {
763
771
  type: 'dark',
764
772
  ...commonTheme,
765
773
  ...darkTheme,
774
+ font,
766
775
  focusRing: (baseShadow = `0 0 0 0 ${darkTheme.tokens.background.primary}`)=>({
767
776
  outline: 'none',
768
777
  boxShadow: `${baseShadow}, 0 0 0 2px ${darkTheme.tokens.focus["default"]}`
@@ -1,4 +1,5 @@
1
1
  import type { size } from '../tokens/size.js';
2
+ import type { lightTheme } from './light.js';
2
3
  /**
3
4
  * Font size constraint for body typography.
4
5
  */
@@ -51,9 +52,26 @@ export type ContentVariant = Exclude<SemanticVariant, 'neutral'> | 'primary' | '
51
52
  */
52
53
  export type GraphicsVariant = SemanticVariant;
53
54
  /**
54
- * Border color variant.
55
+ * Dot paths to every leaf of a token object, e.g. `'transparent.neutral.muted'`.
55
56
  */
56
- export type BorderVariant = Exclude<SemanticVariant, 'neutral'> | 'primary' | 'secondary' | 'muted' | 'none';
57
+ type TokenPath<T> = {
58
+ [K in keyof T & string]: T[K] extends string ? K : `${K}.${TokenPath<T[K]>}`;
59
+ }[keyof T & string];
60
+ /**
61
+ * Every border color token, as a path into `tokens.border`. Derived from the
62
+ * theme, so a new border token is available without changing this type.
63
+ */
64
+ export type BorderToken = TokenPath<(typeof lightTheme)['tokens']['border']>;
65
+ /**
66
+ * Border color variant: a border token path, or `none` to remove the border.
67
+ */
68
+ export type BorderVariant = BorderToken | 'none';
69
+ /**
70
+ * Every background color token, as a path into `tokens.background`. Derived
71
+ * from the theme, so a new background token is available without changing
72
+ * this type.
73
+ */
74
+ export type BackgroundToken = TokenPath<(typeof lightTheme)['tokens']['background']>;
57
75
  /**
58
76
  * Icon size constraint.
59
77
  */
@@ -2,3 +2,4 @@
2
2
  export type { TranslationContextValue } from './translationContext.js';
3
3
  export declare const TranslationContextProvider: import("react").Provider<import("./translationContext.js").TranslationContextValue>;
4
4
  export { useTranslation } from './useTranslation.js';
5
+ export { pgettext, t, tn, type Translation } from './translate.js';
@@ -1,4 +1,5 @@
1
1
  import { TranslationContext } from "./translationContext.js";
2
2
  const TranslationContextProvider = TranslationContext.Provider;
3
3
  export { useTranslation } from "./useTranslation.js";
4
+ export { pgettext, t, tn } from "./translate.js";
4
5
  export { TranslationContextProvider };
@@ -0,0 +1,9 @@
1
+ import type * as React from 'react';
2
+ export interface Translation {
3
+ pgettext: (context: string, message: string) => string;
4
+ t: (message: string, ...args: Array<React.ReactNode | Record<string, React.ReactNode>>) => string;
5
+ tn: (singular: string, plural: string, count: number) => string;
6
+ }
7
+ export declare const t: Translation['t'];
8
+ export declare const tn: Translation['tn'];
9
+ export declare const pgettext: Translation['pgettext'];
@@ -0,0 +1,5 @@
1
+ import { getSnapshot } from "../dateTime/config.js";
2
+ const t = (message, ...args)=>getSnapshot().messages.t(message, ...args);
3
+ const tn = (singular, plural, count)=>getSnapshot().messages.tn(singular, plural, count);
4
+ const pgettext = (context, message)=>getSnapshot().messages.pgettext(context, message);
5
+ export { pgettext, t, tn };
@@ -1,6 +1,7 @@
1
1
  import type * as React from 'react';
2
+ import { type Translation } from './translate.js';
2
3
  export type TranslationContextValue = {
3
- t: (string: string, ...args: Array<React.ReactNode | Record<string, React.ReactNode>>) => string;
4
+ t: Translation['t'];
4
5
  tct: (template: string, components: Record<string, React.ReactNode>) => React.ReactNode;
5
6
  };
6
7
  export declare const TranslationContext: React.Context<TranslationContextValue>;
@@ -1,6 +1,7 @@
1
1
  import { createContext } from "react";
2
+ import { t } from "./translate.js";
2
3
  const TranslationContext = /*#__PURE__*/ createContext({
3
- t: (string)=>string,
4
+ t: t,
4
5
  tct: (template)=>template
5
6
  });
6
7
  export { TranslationContext };