@sentry/scraps 0.5.0 → 0.7.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 (177) hide show
  1. package/README.md +95 -3
  2. package/dist/alert/alert.js +10 -7
  3. package/dist/badge/tag.js +4 -2
  4. package/dist/button/button.js +1 -0
  5. package/dist/button/linkButton.js +1 -0
  6. package/dist/button/styles.js +157 -152
  7. package/dist/codeBlock/codeBlock.js +1 -0
  8. package/dist/compactSelect/compactSelect.d.ts +2 -2
  9. package/dist/compactSelect/compactSelect.js +37 -23
  10. package/dist/compactSelect/control.js +14 -10
  11. package/dist/compactSelect/gridList/index.js +35 -36
  12. package/dist/compactSelect/gridList/option.d.ts +4 -1
  13. package/dist/compactSelect/gridList/option.js +4 -3
  14. package/dist/compactSelect/gridList/section.d.ts +10 -3
  15. package/dist/compactSelect/gridList/section.js +16 -33
  16. package/dist/compactSelect/listBox/index.d.ts +1 -1
  17. package/dist/compactSelect/listBox/index.js +46 -58
  18. package/dist/compactSelect/listBox/section.d.ts +10 -8
  19. package/dist/compactSelect/listBox/section.js +11 -30
  20. package/dist/compactSelect/styles.d.ts +6 -7
  21. package/dist/compactSelect/styles.js +1 -23
  22. package/dist/compactSelect/utils.js +2 -6
  23. package/dist/dateTime/config.d.ts +23 -0
  24. package/dist/dateTime/config.js +50 -0
  25. package/dist/dateTime/context.d.ts +18 -0
  26. package/dist/dateTime/context.js +46 -0
  27. package/dist/dateTime/dateTime.d.ts +6 -0
  28. package/dist/dateTime/dateTime.js +30 -0
  29. package/dist/dateTime/format.d.ts +24 -0
  30. package/dist/dateTime/format.js +45 -0
  31. package/dist/dateTime/index.d.ts +6 -0
  32. package/dist/dateTime/index.js +6 -0
  33. package/dist/dateTime/intlFormatter.d.ts +9 -0
  34. package/dist/dateTime/intlFormatter.js +16 -0
  35. package/dist/dateTime/parseDate.d.ts +3 -0
  36. package/dist/dateTime/parseDate.js +12 -0
  37. package/dist/diagnostics/context.d.ts +12 -0
  38. package/dist/diagnostics/context.js +11 -0
  39. package/dist/diagnostics/index.d.ts +2 -0
  40. package/dist/diagnostics/index.js +1 -0
  41. package/dist/disclosure/disclosure.js +1 -1
  42. package/dist/dragHandle/dragHandle.js +3 -5
  43. package/dist/dropdownMenu/context.d.ts +36 -11
  44. package/dist/dropdownMenu/context.js +2 -1
  45. package/dist/dropdownMenu/dropdownMenu.d.ts +2 -2
  46. package/dist/dropdownMenu/dropdownMenu.js +9 -3
  47. package/dist/dropdownMenu/item.d.ts +7 -8
  48. package/dist/dropdownMenu/item.js +43 -77
  49. package/dist/dropdownMenu/list.d.ts +31 -5
  50. package/dist/dropdownMenu/list.js +154 -133
  51. package/dist/dropdownMenu/useDropdownMenuKeyboard.d.ts +5 -241
  52. package/dist/dropdownMenu/useDropdownMenuKeyboard.js +5 -29
  53. package/dist/dropdownMenu/useDropdownMenuRowLayout.js +6 -14
  54. package/dist/dropdownMenu/useDropdownRootMenuState.d.ts +13 -0
  55. package/dist/dropdownMenu/useDropdownRootMenuState.js +30 -0
  56. package/dist/dropdownMenu/useDropdownSubmenuState.d.ts +19 -0
  57. package/dist/dropdownMenu/useDropdownSubmenuState.js +25 -0
  58. package/dist/dropdownMenu/utils.js +5 -7
  59. package/dist/duration/formatElapsedDuration.d.ts +4 -0
  60. package/dist/duration/formatElapsedDuration.js +10 -0
  61. package/dist/duration/getDuration.d.ts +68 -0
  62. package/dist/duration/getDuration.js +80 -0
  63. package/dist/duration/index.d.ts +2 -0
  64. package/dist/duration/index.js +2 -0
  65. package/dist/form/field/radioGroupField.d.ts +7 -0
  66. package/dist/form/field/radioGroupField.js +14 -0
  67. package/dist/form/field/selectField.d.ts +3 -4
  68. package/dist/form/field/selectField.js +16 -24
  69. package/dist/{compactSelect/fzf.d.ts → fzf.d.ts} +1 -0
  70. package/dist/{compactSelect/fzf.js → fzf.js} +5 -1
  71. package/dist/layout/container.d.ts +24 -7
  72. package/dist/layout/container.js +9 -12
  73. package/dist/layout/flex.js +1 -1
  74. package/dist/layout/grid.js +2 -2
  75. package/dist/layout/index.d.ts +1 -1
  76. package/dist/layout/index.js +1 -1
  77. package/dist/layout/stack.js +1 -1
  78. package/dist/layout/styles.d.ts +28 -7
  79. package/dist/layout/styles.js +76 -16
  80. package/dist/layout/surface.d.ts +2 -2
  81. package/dist/layout/surface.js +6 -3
  82. package/dist/legacyDatetime.d.ts +21 -0
  83. package/dist/legacyDatetime.js +13 -0
  84. package/dist/link/index.d.ts +1 -1
  85. package/dist/link/index.js +1 -1
  86. package/dist/link/linkBehaviorContext.d.ts +9 -0
  87. package/dist/link/linkBehaviorContext.js +37 -7
  88. package/dist/menu/menu.d.ts +1 -3
  89. package/dist/menu/menu.js +5 -6
  90. package/dist/menu/selectValue.d.ts +2 -6
  91. package/dist/modal/components.js +2 -2
  92. package/dist/overlayArrow.js +2 -2
  93. package/dist/relativeTime/getRelativeDate.d.ts +14 -0
  94. package/dist/relativeTime/getRelativeDate.js +107 -0
  95. package/dist/relativeTime/index.d.ts +3 -0
  96. package/dist/relativeTime/index.js +3 -0
  97. package/dist/relativeTime/relativeTime.d.ts +55 -0
  98. package/dist/relativeTime/relativeTime.js +102 -0
  99. package/dist/relativeTime/useRelativeTimeFormatter.d.ts +2 -0
  100. package/dist/relativeTime/useRelativeTimeFormatter.js +10 -0
  101. package/dist/select/chips.d.ts +14 -0
  102. package/dist/select/chips.js +45 -0
  103. package/dist/select/filter.js +7 -11
  104. package/dist/select/index.d.ts +1 -1
  105. package/dist/select/indicators.d.ts +11 -0
  106. package/dist/select/indicators.js +61 -0
  107. package/dist/select/menu.d.ts +44 -0
  108. package/dist/select/menu.js +103 -0
  109. package/dist/select/option.d.ts +23 -15
  110. package/dist/select/option.js +66 -58
  111. package/dist/select/options.d.ts +31 -0
  112. package/dist/select/options.js +74 -0
  113. package/dist/select/select.d.ts +24 -11
  114. package/dist/select/select.js +527 -429
  115. package/dist/select/styles.d.ts +148 -2
  116. package/dist/select/styles.js +156 -1
  117. package/dist/select/types.d.ts +6 -7
  118. package/dist/select/types.js +4 -0
  119. package/dist/select/utils.d.ts +2 -0
  120. package/dist/select/utils.js +4 -0
  121. package/dist/separator/separator.d.ts +2 -2
  122. package/dist/separator/separator.js +4 -3
  123. package/dist/slot/slot.js +16 -12
  124. package/dist/tabs/context.d.ts +9 -0
  125. package/dist/tabs/context.js +9 -0
  126. package/dist/tabs/index.d.ts +2 -4
  127. package/dist/tabs/index.js +1 -3
  128. package/dist/tabs/item.d.ts +16 -5
  129. package/dist/tabs/tab.js +9 -4
  130. package/dist/tabs/tabList.d.ts +5 -5
  131. package/dist/tabs/tabList.js +8 -6
  132. package/dist/tabs/tabPanels.d.ts +2 -3
  133. package/dist/tabs/tabPanels.js +1 -1
  134. package/dist/tabs/tabs.d.ts +46 -31
  135. package/dist/tabs/tabs.js +38 -35
  136. package/dist/text/prose.d.ts +2 -2
  137. package/dist/theme/index.d.ts +2 -0
  138. package/dist/theme/index.js +2 -0
  139. package/dist/theme/theme.d.ts +34 -34
  140. package/dist/theme/theme.js +9 -0
  141. package/dist/theme/types.d.ts +21 -2
  142. package/dist/theme/useResolvedTheme.d.ts +12 -0
  143. package/dist/theme/useResolvedTheme.js +20 -0
  144. package/dist/theme/variables.css +1116 -0
  145. package/dist/theme/variables.d.ts +985 -0
  146. package/dist/theme/variables.js +455 -0
  147. package/dist/translation/index.d.ts +1 -0
  148. package/dist/translation/index.js +1 -0
  149. package/dist/translation/translate.d.ts +9 -0
  150. package/dist/translation/translate.js +5 -0
  151. package/dist/translation/translationContext.d.ts +2 -1
  152. package/dist/translation/translationContext.js +2 -1
  153. package/dist/useVirtualCollection.d.ts +14 -1
  154. package/dist/useVirtualCollection.js +59 -3
  155. package/fonts/OFL.txt +94 -0
  156. package/fonts/roboto-mono-variable-cyrillic-ext.woff2 +0 -0
  157. package/fonts/roboto-mono-variable-cyrillic.woff2 +0 -0
  158. package/fonts/roboto-mono-variable-greek.woff2 +0 -0
  159. package/fonts/roboto-mono-variable-latin-ext.woff2 +0 -0
  160. package/fonts/roboto-mono-variable-vietnamese.woff2 +0 -0
  161. package/fonts/roboto-mono-variable.woff2 +0 -0
  162. package/fonts/rubik-variable-cyrillic-ext.woff2 +0 -0
  163. package/fonts/rubik-variable-cyrillic.woff2 +0 -0
  164. package/fonts/rubik-variable-latin-ext.woff2 +0 -0
  165. package/fonts/rubik-variable.woff2 +0 -0
  166. package/fonts.css +211 -0
  167. package/package.json +39 -15
  168. package/dist/compactSelect/useVirtualizedItems.d.ts +0 -52
  169. package/dist/compactSelect/useVirtualizedItems.js +0 -74
  170. package/dist/datetime.d.ts +0 -39
  171. package/dist/datetime.js +0 -20
  172. package/dist/dropdownMenu/useSafetyTriangle.d.ts +0 -12
  173. package/dist/dropdownMenu/useSafetyTriangle.js +0 -119
  174. package/dist/select/reactSelectWrapper.d.ts +0 -8
  175. package/dist/select/reactSelectWrapper.js +0 -25
  176. package/dist/select/virtualizedMenuList.d.ts +0 -24
  177. package/dist/select/virtualizedMenuList.js +0 -123
@@ -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
  }, {}, {}>;
@@ -1,5 +1,7 @@
1
1
  export { lightTheme, darkTheme } from './theme.js';
2
2
  export type { SentryTheme as Theme, StrictCSSObject } from './theme.js';
3
3
  export { baseTheme } from './base.js';
4
+ export { themeVariables } from './variables.js';
4
5
  export type * from './types.js';
5
6
  export { useInvertedTheme } from './useInvertedTheme.js';
7
+ export { resolveTheme, useResolvedTheme } from './useResolvedTheme.js';
@@ -1,3 +1,5 @@
1
1
  export { darkTheme, lightTheme } from "./theme.js";
2
2
  export { baseTheme } from "./base.js";
3
+ export { themeVariables } from "./variables.js";
3
4
  export { useInvertedTheme } from "./useInvertedTheme.js";
5
+ export { resolveTheme, useResolvedTheme } from "./useResolvedTheme.js";
@@ -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,27 @@ 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']>;
75
+ export type BorderWidthToken = keyof (typeof lightTheme)['border'];
57
76
  /**
58
77
  * Icon size constraint.
59
78
  */
@@ -0,0 +1,12 @@
1
+ import { type SentryTheme } from './theme.js';
2
+ /**
3
+ * Returns `theme` with literal color values for its `type`. Theme tokens can be
4
+ * `var(--scraps-*)` strings, which only resolve inside CSS, so use this
5
+ * wherever a theme value leaves a stylesheet: ECharts options, canvas drawing,
6
+ * the `color` library, or numeric parsing.
7
+ */
8
+ export declare function resolveTheme(theme: SentryTheme): SentryTheme;
9
+ /**
10
+ * The current Emotion theme with literal color values. See `resolveTheme`.
11
+ */
12
+ export declare function useResolvedTheme(): SentryTheme;
@@ -0,0 +1,20 @@
1
+ import { useMemo } from "react";
2
+ import { useTheme } from "@emotion/react";
3
+ import { darkTheme, lightTheme } from "./theme.js";
4
+ function resolveTheme(theme) {
5
+ const literalTheme = 'dark' === theme.type ? darkTheme : lightTheme;
6
+ if (theme.tokens === literalTheme.tokens) return theme;
7
+ return {
8
+ ...theme,
9
+ tokens: literalTheme.tokens,
10
+ shadow: literalTheme.shadow,
11
+ focusRing: literalTheme.focusRing
12
+ };
13
+ }
14
+ function useResolvedTheme() {
15
+ const theme = useTheme();
16
+ return useMemo(()=>resolveTheme(theme), [
17
+ theme
18
+ ]);
19
+ }
20
+ export { resolveTheme, useResolvedTheme };