@sentry/scraps 0.6.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.
- package/README.md +27 -0
- package/dist/alert/alert.js +10 -7
- package/dist/compactSelect/compactSelect.d.ts +2 -2
- package/dist/compactSelect/compactSelect.js +37 -23
- package/dist/compactSelect/control.js +12 -9
- package/dist/compactSelect/gridList/index.js +35 -36
- package/dist/compactSelect/gridList/option.d.ts +4 -1
- package/dist/compactSelect/gridList/option.js +4 -3
- package/dist/compactSelect/gridList/section.d.ts +10 -3
- package/dist/compactSelect/gridList/section.js +16 -33
- package/dist/compactSelect/listBox/index.d.ts +1 -1
- package/dist/compactSelect/listBox/index.js +46 -58
- package/dist/compactSelect/listBox/section.d.ts +10 -8
- package/dist/compactSelect/listBox/section.js +11 -30
- package/dist/compactSelect/styles.d.ts +6 -7
- package/dist/compactSelect/styles.js +1 -23
- package/dist/diagnostics/context.d.ts +12 -0
- package/dist/diagnostics/context.js +11 -0
- package/dist/diagnostics/index.d.ts +2 -0
- package/dist/diagnostics/index.js +1 -0
- package/dist/disclosure/disclosure.js +1 -1
- package/dist/dragHandle/dragHandle.js +3 -5
- package/dist/dropdownMenu/context.d.ts +10 -0
- package/dist/dropdownMenu/context.js +2 -1
- package/dist/dropdownMenu/item.d.ts +2 -7
- package/dist/dropdownMenu/item.js +13 -7
- package/dist/dropdownMenu/list.js +25 -23
- package/dist/dropdownMenu/useDropdownMenuRowLayout.js +6 -14
- package/dist/form/field/radioGroupField.d.ts +7 -0
- package/dist/form/field/radioGroupField.js +14 -0
- package/dist/form/field/selectField.d.ts +3 -4
- package/dist/form/field/selectField.js +16 -24
- package/dist/layout/container.d.ts +18 -7
- package/dist/layout/container.js +8 -11
- package/dist/layout/flex.js +1 -1
- package/dist/layout/grid.js +2 -2
- package/dist/layout/index.d.ts +1 -1
- package/dist/layout/index.js +1 -1
- package/dist/layout/stack.js +1 -1
- package/dist/layout/styles.d.ts +28 -8
- package/dist/layout/styles.js +67 -13
- package/dist/layout/surface.d.ts +2 -2
- package/dist/layout/surface.js +6 -3
- package/dist/menu/menu.js +4 -4
- package/dist/menu/selectValue.d.ts +2 -6
- package/dist/modal/components.js +2 -2
- package/dist/overlayArrow.js +2 -2
- package/dist/select/chips.d.ts +14 -0
- package/dist/select/chips.js +45 -0
- package/dist/select/filter.js +7 -11
- package/dist/select/index.d.ts +1 -1
- package/dist/select/indicators.d.ts +11 -0
- package/dist/select/indicators.js +61 -0
- package/dist/select/menu.d.ts +44 -0
- package/dist/select/menu.js +103 -0
- package/dist/select/option.d.ts +23 -15
- package/dist/select/option.js +66 -58
- package/dist/select/options.d.ts +31 -0
- package/dist/select/options.js +74 -0
- package/dist/select/select.d.ts +24 -11
- package/dist/select/select.js +527 -429
- package/dist/select/styles.d.ts +148 -2
- package/dist/select/styles.js +156 -1
- package/dist/select/types.d.ts +6 -7
- package/dist/select/types.js +4 -0
- package/dist/select/utils.d.ts +2 -0
- package/dist/select/utils.js +4 -0
- package/dist/separator/separator.d.ts +2 -2
- package/dist/separator/separator.js +4 -3
- package/dist/slot/slot.js +16 -12
- package/dist/tabs/tab.js +3 -1
- package/dist/theme/index.d.ts +2 -0
- package/dist/theme/index.js +2 -0
- package/dist/theme/types.d.ts +1 -0
- package/dist/theme/useResolvedTheme.d.ts +12 -0
- package/dist/theme/useResolvedTheme.js +20 -0
- package/dist/theme/variables.css +1116 -0
- package/dist/theme/variables.d.ts +985 -0
- package/dist/theme/variables.js +455 -0
- package/dist/useVirtualCollection.d.ts +14 -1
- package/dist/useVirtualCollection.js +59 -3
- package/package.json +12 -6
- package/dist/compactSelect/useVirtualizedItems.d.ts +0 -52
- package/dist/compactSelect/useVirtualizedItems.js +0 -74
- package/dist/select/reactSelectWrapper.d.ts +0 -8
- package/dist/select/reactSelectWrapper.js +0 -25
- package/dist/select/virtualizedMenuList.d.ts +0 -24
- package/dist/select/virtualizedMenuList.js +0 -123
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import type { Node } from '@react-types/shared';
|
|
2
|
-
import type { FormSize } from '../theme/index.js';
|
|
3
|
-
type ObjectLike = object;
|
|
4
|
-
export declare function useVirtualizedItems<T extends ObjectLike>({ listItems, listPadding, virtualized, size, }: {
|
|
5
|
-
listItems: Array<Node<T>>;
|
|
6
|
-
size: FormSize;
|
|
7
|
-
virtualized: boolean | undefined;
|
|
8
|
-
listPadding?: number;
|
|
9
|
-
}): {
|
|
10
|
-
readonly items: import("@tanstack/react-virtual").VirtualItem[];
|
|
11
|
-
readonly scrollToIndex: (index: number) => void;
|
|
12
|
-
readonly scrollElementRef: import("react").RefObject<HTMLDivElement | null>;
|
|
13
|
-
readonly itemProps: (index: number) => {
|
|
14
|
-
ref: (node: Element | null) => void;
|
|
15
|
-
'data-index': number;
|
|
16
|
-
};
|
|
17
|
-
readonly wrapperProps: {
|
|
18
|
-
readonly 'data-is-virtualized': true;
|
|
19
|
-
readonly style: {
|
|
20
|
-
readonly height: number;
|
|
21
|
-
readonly width: "100%";
|
|
22
|
-
readonly position: "relative";
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
readonly listWrapStyle: {
|
|
26
|
-
readonly position: "absolute";
|
|
27
|
-
readonly top: 0;
|
|
28
|
-
readonly left: 0;
|
|
29
|
-
readonly width: "100%";
|
|
30
|
-
readonly transform: `translateY(${number}px)`;
|
|
31
|
-
};
|
|
32
|
-
} | {
|
|
33
|
-
readonly items: {
|
|
34
|
-
index: number;
|
|
35
|
-
start: number;
|
|
36
|
-
}[];
|
|
37
|
-
readonly scrollToIndex: () => void;
|
|
38
|
-
readonly scrollElementRef: undefined;
|
|
39
|
-
readonly itemProps: () => void;
|
|
40
|
-
readonly wrapperProps: {
|
|
41
|
-
readonly 'data-is-virtualized': false;
|
|
42
|
-
readonly style?: undefined;
|
|
43
|
-
};
|
|
44
|
-
readonly listWrapStyle: {
|
|
45
|
-
readonly position?: undefined;
|
|
46
|
-
readonly top?: undefined;
|
|
47
|
-
readonly left?: undefined;
|
|
48
|
-
readonly width?: undefined;
|
|
49
|
-
readonly transform?: undefined;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
export {};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { useRef } from "react";
|
|
2
|
-
import { useVirtualRows } from "../useVirtualRows.js";
|
|
3
|
-
const heightEstimations = {
|
|
4
|
-
sm: {
|
|
5
|
-
regular: 32,
|
|
6
|
-
large: 49
|
|
7
|
-
},
|
|
8
|
-
md: {
|
|
9
|
-
regular: 36,
|
|
10
|
-
large: 53
|
|
11
|
-
},
|
|
12
|
-
xs: {
|
|
13
|
-
regular: 25,
|
|
14
|
-
large: 42
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
const listPaddingVertical = 4;
|
|
18
|
-
function useVirtualizedItems({ listItems, listPadding = listPaddingVertical, virtualized = false, size }) {
|
|
19
|
-
const scrollElementRef = useRef(null);
|
|
20
|
-
const heightEstimation = heightEstimations[size];
|
|
21
|
-
const { totalSize, virtualItems, virtualizer } = useVirtualRows({
|
|
22
|
-
count: listItems.length,
|
|
23
|
-
getScrollElement: ()=>scrollElementRef?.current,
|
|
24
|
-
estimateSize: (index)=>{
|
|
25
|
-
const item = listItems[index];
|
|
26
|
-
if (item?.props?.details) return heightEstimation.large;
|
|
27
|
-
return heightEstimation.regular;
|
|
28
|
-
},
|
|
29
|
-
enabled: virtualized,
|
|
30
|
-
overscan: 1
|
|
31
|
-
});
|
|
32
|
-
if (virtualized) return {
|
|
33
|
-
items: virtualItems,
|
|
34
|
-
scrollToIndex: (index)=>{
|
|
35
|
-
virtualizer.scrollToIndex(index, {
|
|
36
|
-
align: 'auto'
|
|
37
|
-
});
|
|
38
|
-
},
|
|
39
|
-
scrollElementRef,
|
|
40
|
-
itemProps: (index)=>({
|
|
41
|
-
ref: virtualizer.measureElement,
|
|
42
|
-
'data-index': index
|
|
43
|
-
}),
|
|
44
|
-
wrapperProps: {
|
|
45
|
-
'data-is-virtualized': true,
|
|
46
|
-
style: {
|
|
47
|
-
height: totalSize + 2 * listPadding,
|
|
48
|
-
width: '100%',
|
|
49
|
-
position: 'relative'
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
listWrapStyle: {
|
|
53
|
-
position: 'absolute',
|
|
54
|
-
top: 0,
|
|
55
|
-
left: 0,
|
|
56
|
-
width: '100%',
|
|
57
|
-
transform: `translateY(${virtualItems[0]?.start ?? 0}px)`
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
return {
|
|
61
|
-
items: listItems.map((_, index)=>({
|
|
62
|
-
index,
|
|
63
|
-
start: 0
|
|
64
|
-
})),
|
|
65
|
-
scrollToIndex: ()=>{},
|
|
66
|
-
scrollElementRef: void 0,
|
|
67
|
-
itemProps: ()=>{},
|
|
68
|
-
wrapperProps: {
|
|
69
|
-
'data-is-virtualized': false
|
|
70
|
-
},
|
|
71
|
-
listWrapStyle: {}
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
export { useVirtualizedItems };
|
|
@@ -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 };
|