@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
@@ -1,12 +0,0 @@
1
- import type * as React from 'react';
2
- type Point = {
3
- x: number;
4
- y: number;
5
- };
6
- export declare function useSafetyTriangle(): {
7
- cancel: () => void;
8
- start(origin: Point, submenu: HTMLElement): void;
9
- defer(event: React.PointerEvent<HTMLElement>, enter: () => void): void;
10
- leave(target: HTMLElement): void;
11
- };
12
- export {};
@@ -1,119 +0,0 @@
1
- import { useEffect, useState } from "react";
2
- function useSafetyTriangle() {
3
- const [triangle] = useState(()=>{
4
- let corridor = null;
5
- let pending = null;
6
- let timeout;
7
- let abortController;
8
- function cancel() {
9
- abortController?.abort();
10
- corridor = null;
11
- pending = null;
12
- clearTimeout(timeout);
13
- }
14
- function release() {
15
- const hover = pending;
16
- cancel();
17
- if (hover?.target.isConnected) hover.enter();
18
- }
19
- function contains(point) {
20
- if (!corridor) return false;
21
- const { origin, edge } = corridor;
22
- const cross = (a, b)=>(b.x - a.x) * (point.y - a.y) - (b.y - a.y) * (point.x - a.x);
23
- const sides = [
24
- cross(origin, edge[0]),
25
- cross(edge[0], edge[1]),
26
- cross(edge[1], origin)
27
- ];
28
- return sides.every((side)=>side >= 0) || sides.every((side)=>side <= 0);
29
- }
30
- function move(event) {
31
- if (corridor?.submenu.contains(event.target)) cancel();
32
- else if (!contains({
33
- x: event.clientX,
34
- y: event.clientY
35
- })) release();
36
- }
37
- return {
38
- cancel,
39
- start (origin, submenu) {
40
- cancel();
41
- const rect = submenu.getBoundingClientRect();
42
- if (!rect.width || !rect.height) return;
43
- let edge;
44
- if (origin.x < rect.left || origin.x > rect.right) {
45
- const x = origin.x < rect.left ? rect.left : rect.right;
46
- edge = [
47
- {
48
- x,
49
- y: rect.top
50
- },
51
- {
52
- x,
53
- y: rect.bottom
54
- }
55
- ];
56
- } else {
57
- if (!(origin.y < rect.top) && !(origin.y > rect.bottom)) return;
58
- const y = origin.y < rect.top ? rect.top : rect.bottom;
59
- edge = [
60
- {
61
- x: rect.left,
62
- y
63
- },
64
- {
65
- x: rect.right,
66
- y
67
- }
68
- ];
69
- }
70
- corridor = {
71
- origin,
72
- edge,
73
- submenu
74
- };
75
- timeout = setTimeout(release, 300);
76
- abortController = new AbortController();
77
- const { signal } = abortController;
78
- document.addEventListener('pointermove', move, {
79
- signal
80
- });
81
- document.addEventListener('pointerdown', release, {
82
- capture: true,
83
- signal
84
- });
85
- document.addEventListener('keydown', cancel, {
86
- capture: true,
87
- signal
88
- });
89
- },
90
- defer (event, enter) {
91
- if ('mouse' !== event.pointerType) {
92
- release();
93
- enter();
94
- return;
95
- }
96
- if (!contains({
97
- x: event.clientX,
98
- y: event.clientY
99
- })) {
100
- cancel();
101
- enter();
102
- return;
103
- }
104
- pending = {
105
- target: event.currentTarget,
106
- enter
107
- };
108
- },
109
- leave (target) {
110
- if (pending?.target === target) pending = null;
111
- }
112
- };
113
- });
114
- useEffect(()=>()=>triangle.cancel(), [
115
- triangle
116
- ]);
117
- return triangle;
118
- }
119
- export { useSafetyTriangle };
@@ -1,8 +0,0 @@
1
- import ReactSelectModule, { components } from 'react-select';
2
- import type CreatableComponent from 'react-select/creatable';
3
- declare const ReactSelect: typeof ReactSelectModule;
4
- declare const Creatable: typeof CreatableComponent;
5
- declare const ReactSelectWrapper: typeof ReactSelect;
6
- export { ReactSelectWrapper as ReactSelect, Creatable, components };
7
- export { createFilter, mergeStyles } from 'react-select';
8
- export type { NamedProps as Props, StylesConfig, OptionsType, ValueType, } from 'react-select';
@@ -1,25 +0,0 @@
1
- import { jsx } from "@emotion/react/jsx-runtime";
2
- import react_select, { components, createFilter, mergeStyles } from "react-select";
3
- import react_select_cjs from "react-select/creatable/dist/react-select.cjs.js";
4
- function unwrapDefault(value) {
5
- return 'object' == typeof value && null !== value && 'default' in value ? value.default : value;
6
- }
7
- const ReactSelect = unwrapDefault(react_select);
8
- const Creatable = unwrapDefault(react_select_cjs);
9
- const reactSelectDefaultProps = {
10
- ...ReactSelect.defaultProps
11
- };
12
- ReactSelect.defaultProps = void 0;
13
- components.MultiValue.defaultProps = void 0;
14
- components.NoOptionsMessage.defaultProps = void 0;
15
- components.LoadingMessage.defaultProps = void 0;
16
- components.LoadingIndicator.defaultProps = void 0;
17
- const ReactSelectWrapper = function({ ref, ...props }) {
18
- return /*#__PURE__*/ jsx(ReactSelect, {
19
- ...reactSelectDefaultProps,
20
- ...props,
21
- ref: ref,
22
- menuPlacement: "auto"
23
- });
24
- };
25
- export { Creatable, ReactSelectWrapper as ReactSelect, components, createFilter, mergeStyles };
@@ -1,24 +0,0 @@
1
- import type * as React from 'react';
2
- /**
3
- * Virtualized MenuList for the Select (react-select) component.
4
- * react-select re-renders every Option on hover/focus changes, which
5
- * causes ~1s lag with 130+ platform options containing PlatformIcon SVGs.
6
- * Virtualizing limits mounted components to the visible set.
7
- *
8
- * Supports grouped options: react-select renders each group as a single
9
- * <Group> element wrapping its Option children, which would virtualize as one
10
- * giant row. Groups are flattened here into heading + option rows instead,
11
- * with per-row measurement since headings and options differ in height.
12
- *
13
- * Implementation detail of the shared Select virtualized prop.
14
- */
15
- import { type Ref } from 'react';
16
- interface VirtualizedMenuListProps {
17
- children: React.ReactNode;
18
- focusedOption?: unknown;
19
- innerProps?: React.HTMLAttributes<HTMLDivElement>;
20
- innerRef?: Ref<HTMLDivElement>;
21
- maxHeight?: number;
22
- }
23
- export declare function VirtualizedMenuList({ children, focusedOption, maxHeight, innerRef, innerProps, }: VirtualizedMenuListProps): import("@emotion/react/jsx-runtime").JSX.Element;
24
- export {};
@@ -1,123 +0,0 @@
1
- import { jsx, jsxs } from "@emotion/react/jsx-runtime";
2
- import { Children, isValidElement, useEffect, useRef } from "react";
3
- import { useTheme } from "@emotion/react";
4
- import { getInteractionModality } from "@react-aria/interactions";
5
- import { mergeRefs } from "@react-aria/utils";
6
- import { useVirtualRows } from "../useVirtualRows.js";
7
- const OPTION_HEIGHT = 36;
8
- const GROUP_HEADING_HEIGHT = 24;
9
- const MAX_MENU_HEIGHT = 300;
10
- const MENU_PADDING = 4;
11
- function toOptionRow(node, fallbackKey) {
12
- const element = /*#__PURE__*/ isValidElement(node) ? node : null;
13
- return {
14
- isHeading: false,
15
- key: element?.key ?? fallbackKey,
16
- node,
17
- data: element?.props.data
18
- };
19
- }
20
- function flattenMenuRows(children) {
21
- const rows = [];
22
- for (const child of children){
23
- if (!/*#__PURE__*/ isValidElement(child) || !child.props.Heading) {
24
- rows.push(toOptionRow(child, rows.length));
25
- continue;
26
- }
27
- const { Heading, headingProps, label, selectProps, theme, getStyles, cx } = child.props;
28
- rows.push({
29
- isHeading: true,
30
- key: child.key ?? rows.length,
31
- node: /*#__PURE__*/ jsx(Heading, {
32
- ...headingProps,
33
- selectProps: selectProps,
34
- theme: theme,
35
- getStyles: getStyles,
36
- cx: cx,
37
- children: label
38
- })
39
- });
40
- const groupOptions = Children.toArray(child.props.children);
41
- for (const option of groupOptions)rows.push(toOptionRow(option, rows.length));
42
- }
43
- return rows;
44
- }
45
- function VirtualizedMenuList({ children, focusedOption, maxHeight = MAX_MENU_HEIGHT, innerRef, innerProps }) {
46
- const theme = useTheme();
47
- const rows = Array.isArray(children) ? flattenMenuRows(Children.toArray(children)) : [];
48
- const scrollRef = useRef(null);
49
- const combinedRef = mergeRefs(scrollRef, innerRef ?? null);
50
- const visibleOptionCount = Math.max(1, Math.floor((maxHeight - 2 * MENU_PADDING) / OPTION_HEIGHT));
51
- const alignedMaxHeight = visibleOptionCount * OPTION_HEIGHT + 2 * MENU_PADDING;
52
- const { totalSize, virtualItems, virtualizer } = useVirtualRows({
53
- count: rows.length,
54
- getScrollElement: ()=>scrollRef.current,
55
- estimateSize: (index)=>rows[index]?.isHeading ? GROUP_HEADING_HEIGHT : OPTION_HEIGHT,
56
- getItemKey: (index)=>rows[index]?.key ?? index,
57
- paddingStart: MENU_PADDING,
58
- paddingEnd: MENU_PADDING,
59
- scrollPaddingStart: MENU_PADDING,
60
- scrollPaddingEnd: MENU_PADDING
61
- });
62
- const focusedIndex = rows.findIndex((row)=>!row.isHeading && row.data === focusedOption);
63
- useEffect(()=>{
64
- if (-1 !== focusedIndex && 'pointer' !== getInteractionModality()) virtualizer.scrollToIndex(focusedIndex, {
65
- align: 'auto'
66
- });
67
- }, [
68
- focusedIndex,
69
- virtualizer
70
- ]);
71
- if (!Array.isArray(children)) return /*#__PURE__*/ jsx("div", {
72
- ref: innerRef,
73
- ...innerProps,
74
- style: {
75
- maxHeight,
76
- overflowY: 'auto'
77
- },
78
- children: children
79
- });
80
- return /*#__PURE__*/ jsx("div", {
81
- ref: combinedRef,
82
- ...innerProps,
83
- style: {
84
- maxHeight: alignedMaxHeight,
85
- overflowY: 'auto'
86
- },
87
- children: /*#__PURE__*/ jsx("div", {
88
- style: {
89
- height: totalSize,
90
- position: 'relative'
91
- },
92
- children: virtualItems.map((virtualRow)=>{
93
- const row = rows[virtualRow.index];
94
- return /*#__PURE__*/ jsxs("div", {
95
- ref: virtualizer.measureElement,
96
- "data-index": virtualRow.index,
97
- style: {
98
- position: 'absolute',
99
- top: 0,
100
- left: 0,
101
- width: '100%',
102
- transform: `translateY(${virtualRow.start}px)`
103
- },
104
- children: [
105
- row?.isHeading && virtualRow.index > 0 && /*#__PURE__*/ jsx("div", {
106
- "data-test-id": "menu-group-divider",
107
- style: {
108
- padding: `${theme.space.md} ${theme.space.lg}`
109
- },
110
- children: /*#__PURE__*/ jsx("div", {
111
- style: {
112
- borderTop: `1px solid ${theme.tokens.border.secondary}`
113
- }
114
- })
115
- }),
116
- row?.node
117
- ]
118
- }, virtualRow.key);
119
- })
120
- })
121
- });
122
- }
123
- export { VirtualizedMenuList };