@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
package/dist/select/styles.d.ts
CHANGED
|
@@ -1,9 +1,155 @@
|
|
|
1
|
-
import type { FormSize } from '../theme/index.js';
|
|
1
|
+
import type { FormSize, Theme } from '../theme/index.js';
|
|
2
2
|
export declare const CheckWrap: import("@emotion/styled").StyledComponent<{
|
|
3
3
|
theme?: import("@emotion/react").Theme;
|
|
4
4
|
as?: React.ElementType;
|
|
5
5
|
} & {
|
|
6
6
|
isMultiple: boolean;
|
|
7
7
|
isSelected: boolean;
|
|
8
|
-
size: FormSize;
|
|
9
8
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
9
|
+
export declare function getSelectStyles(theme: Theme, size: FormSize, { disabled, focused, hasChips, hasQuery, searchable, }: {
|
|
10
|
+
focused: boolean;
|
|
11
|
+
hasChips: boolean;
|
|
12
|
+
hasQuery: boolean;
|
|
13
|
+
searchable: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
}): {
|
|
16
|
+
container: {
|
|
17
|
+
position: "relative";
|
|
18
|
+
};
|
|
19
|
+
control: {
|
|
20
|
+
minHeight: "32px" | "36px" | "28px";
|
|
21
|
+
fontSize: "0.875rem" | "0.75rem";
|
|
22
|
+
lineHeight: "1rem";
|
|
23
|
+
cursor: "not-allowed" | "pointer";
|
|
24
|
+
opacity: number | undefined;
|
|
25
|
+
outline?: string | undefined;
|
|
26
|
+
boxShadow: string;
|
|
27
|
+
display: "flex";
|
|
28
|
+
alignItems: "center";
|
|
29
|
+
color: string;
|
|
30
|
+
background: string;
|
|
31
|
+
border: string;
|
|
32
|
+
borderRadius: "6px" | "8px" | "5px";
|
|
33
|
+
};
|
|
34
|
+
leadingItems: {
|
|
35
|
+
paddingInlineStart: 16 | 8 | 12;
|
|
36
|
+
};
|
|
37
|
+
values: {
|
|
38
|
+
display: "flex" | "grid";
|
|
39
|
+
flex: number;
|
|
40
|
+
minWidth: number;
|
|
41
|
+
alignItems: "center";
|
|
42
|
+
flexWrap: "wrap" | undefined;
|
|
43
|
+
maxHeight: string | undefined;
|
|
44
|
+
overflowY: "auto" | undefined;
|
|
45
|
+
paddingLeft: 16 | 8 | 12;
|
|
46
|
+
gap: "4px" | undefined;
|
|
47
|
+
};
|
|
48
|
+
input: {
|
|
49
|
+
gridArea: "1 / 1" | undefined;
|
|
50
|
+
flex: string | undefined;
|
|
51
|
+
minWidth: number;
|
|
52
|
+
width: string | number;
|
|
53
|
+
border: number;
|
|
54
|
+
padding: number;
|
|
55
|
+
margin: number;
|
|
56
|
+
background: string;
|
|
57
|
+
color: string;
|
|
58
|
+
caretColor: "transparent" | undefined;
|
|
59
|
+
font: "inherit";
|
|
60
|
+
outline: string;
|
|
61
|
+
cursor: "inherit" | "text";
|
|
62
|
+
':disabled': {
|
|
63
|
+
cursor: "not-allowed";
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
singleValue: {
|
|
67
|
+
gridArea: "1 / 1";
|
|
68
|
+
display: "flex";
|
|
69
|
+
alignItems: "center";
|
|
70
|
+
gap: "8px";
|
|
71
|
+
minWidth: number;
|
|
72
|
+
color: string;
|
|
73
|
+
};
|
|
74
|
+
valueLabel: {
|
|
75
|
+
whiteSpace: "nowrap";
|
|
76
|
+
textOverflow: "ellipsis";
|
|
77
|
+
overflow: "hidden";
|
|
78
|
+
};
|
|
79
|
+
placeholder: {
|
|
80
|
+
gridArea: "1 / 1";
|
|
81
|
+
color: string;
|
|
82
|
+
};
|
|
83
|
+
indicators: {
|
|
84
|
+
marginInlineStart: "6px";
|
|
85
|
+
marginInlineEnd: 16 | 8 | 12;
|
|
86
|
+
};
|
|
87
|
+
clearIcon: {
|
|
88
|
+
width: number;
|
|
89
|
+
height: number;
|
|
90
|
+
};
|
|
91
|
+
chip: {
|
|
92
|
+
display: "flex";
|
|
93
|
+
alignItems: "center";
|
|
94
|
+
borderRadius: number;
|
|
95
|
+
border: string;
|
|
96
|
+
background: string;
|
|
97
|
+
boxShadow: `0 1px 0 0 ${string}`;
|
|
98
|
+
marginBlock: number;
|
|
99
|
+
};
|
|
100
|
+
chipLabel: {
|
|
101
|
+
display: "flex";
|
|
102
|
+
alignItems: "center";
|
|
103
|
+
minHeight: number;
|
|
104
|
+
paddingInlineEnd: "2px" | "4px";
|
|
105
|
+
paddingInlineStart: "4px" | "6px" | "8px";
|
|
106
|
+
};
|
|
107
|
+
chipRemove: {
|
|
108
|
+
display: "flex";
|
|
109
|
+
alignItems: "center";
|
|
110
|
+
alignSelf: "stretch";
|
|
111
|
+
padding: string;
|
|
112
|
+
paddingRight: "4px" | "6px" | "8px";
|
|
113
|
+
border: number;
|
|
114
|
+
background: string;
|
|
115
|
+
color: "inherit";
|
|
116
|
+
cursor: "pointer";
|
|
117
|
+
':hover': {
|
|
118
|
+
background: string;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
chipRemoveIcon: {
|
|
122
|
+
width: number;
|
|
123
|
+
height: number;
|
|
124
|
+
};
|
|
125
|
+
menu: {
|
|
126
|
+
background: string;
|
|
127
|
+
borderRadius: "6px";
|
|
128
|
+
border: string;
|
|
129
|
+
minWidth: string;
|
|
130
|
+
width: string;
|
|
131
|
+
maxHeight: string;
|
|
132
|
+
display: "flex";
|
|
133
|
+
flexDirection: "column";
|
|
134
|
+
};
|
|
135
|
+
menuList: {
|
|
136
|
+
listStyle: "none";
|
|
137
|
+
margin: number;
|
|
138
|
+
padding: string;
|
|
139
|
+
overflowY: "auto";
|
|
140
|
+
};
|
|
141
|
+
heading: {
|
|
142
|
+
fontWeight: number;
|
|
143
|
+
lineHeight: number;
|
|
144
|
+
color: string;
|
|
145
|
+
padding: string;
|
|
146
|
+
':empty': {
|
|
147
|
+
display: "none";
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
message: {
|
|
151
|
+
padding: "8px";
|
|
152
|
+
color: string;
|
|
153
|
+
textAlign: "center";
|
|
154
|
+
};
|
|
155
|
+
};
|
package/dist/select/styles.js
CHANGED
|
@@ -17,6 +17,7 @@ const CheckWrap = styled('div')`
|
|
|
17
17
|
${p.isSelected && css`
|
|
18
18
|
background: ${p.theme.tokens.background.accent.vibrant};
|
|
19
19
|
border-color: ${p.theme.tokens.border.accent};
|
|
20
|
+
color: ${p.theme.tokens.content.onVibrant.light};
|
|
20
21
|
`}
|
|
21
22
|
` : css`
|
|
22
23
|
${p.isSelected && css`
|
|
@@ -24,4 +25,158 @@ const CheckWrap = styled('div')`
|
|
|
24
25
|
`}
|
|
25
26
|
`}
|
|
26
27
|
`;
|
|
27
|
-
|
|
28
|
+
const chipLabelHeights = {
|
|
29
|
+
xs: 16,
|
|
30
|
+
sm: 18,
|
|
31
|
+
md: 20
|
|
32
|
+
};
|
|
33
|
+
function getSelectStyles(theme, size, { disabled, focused, hasChips, hasQuery, searchable }) {
|
|
34
|
+
const border = theme.tokens.border.primary;
|
|
35
|
+
const background = theme.tokens.interactive.chonky.debossed.neutral;
|
|
36
|
+
const color = disabled ? theme.tokens.content.disabled : theme.tokens.content.primary;
|
|
37
|
+
const insetShadow = `0 1px 0 0 ${background.chonk} inset`;
|
|
38
|
+
const form = theme.form[size];
|
|
39
|
+
const inputWidth = hasQuery ? '1em' : 2;
|
|
40
|
+
return {
|
|
41
|
+
container: {
|
|
42
|
+
position: 'relative'
|
|
43
|
+
},
|
|
44
|
+
control: {
|
|
45
|
+
display: 'flex',
|
|
46
|
+
alignItems: 'center',
|
|
47
|
+
color,
|
|
48
|
+
background: disabled ? theme.tokens.background.primary : background.background,
|
|
49
|
+
border: `1px solid ${border}`,
|
|
50
|
+
borderRadius: form.borderRadius,
|
|
51
|
+
boxShadow: insetShadow,
|
|
52
|
+
...focused && theme.focusRing(insetShadow),
|
|
53
|
+
minHeight: form.minHeight,
|
|
54
|
+
fontSize: form.fontSize,
|
|
55
|
+
lineHeight: form.lineHeight,
|
|
56
|
+
cursor: disabled ? 'not-allowed' : 'pointer',
|
|
57
|
+
opacity: disabled ? 0.6 : void 0
|
|
58
|
+
},
|
|
59
|
+
leadingItems: {
|
|
60
|
+
paddingInlineStart: form.paddingLeft
|
|
61
|
+
},
|
|
62
|
+
values: {
|
|
63
|
+
display: hasChips ? 'flex' : 'grid',
|
|
64
|
+
flex: 1,
|
|
65
|
+
minWidth: 0,
|
|
66
|
+
alignItems: 'center',
|
|
67
|
+
flexWrap: hasChips ? 'wrap' : void 0,
|
|
68
|
+
maxHeight: hasChips ? '12em' : void 0,
|
|
69
|
+
overflowY: hasChips ? 'auto' : void 0,
|
|
70
|
+
paddingLeft: form.paddingLeft,
|
|
71
|
+
gap: hasChips ? theme.space.xs : void 0
|
|
72
|
+
},
|
|
73
|
+
input: {
|
|
74
|
+
gridArea: hasChips ? void 0 : '1 / 1',
|
|
75
|
+
flex: hasChips ? '1 1 auto' : void 0,
|
|
76
|
+
minWidth: 0,
|
|
77
|
+
width: hasChips ? inputWidth : '100%',
|
|
78
|
+
border: 0,
|
|
79
|
+
padding: 0,
|
|
80
|
+
margin: 0,
|
|
81
|
+
background: 'transparent',
|
|
82
|
+
color,
|
|
83
|
+
caretColor: searchable ? void 0 : 'transparent',
|
|
84
|
+
font: 'inherit',
|
|
85
|
+
outline: 'none',
|
|
86
|
+
cursor: !disabled && searchable ? 'text' : 'inherit',
|
|
87
|
+
':disabled': {
|
|
88
|
+
cursor: 'not-allowed'
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
singleValue: {
|
|
92
|
+
gridArea: '1 / 1',
|
|
93
|
+
display: 'flex',
|
|
94
|
+
alignItems: 'center',
|
|
95
|
+
gap: theme.space.md,
|
|
96
|
+
minWidth: 0,
|
|
97
|
+
color
|
|
98
|
+
},
|
|
99
|
+
valueLabel: {
|
|
100
|
+
whiteSpace: 'nowrap',
|
|
101
|
+
textOverflow: 'ellipsis',
|
|
102
|
+
overflow: 'hidden'
|
|
103
|
+
},
|
|
104
|
+
placeholder: {
|
|
105
|
+
gridArea: '1 / 1',
|
|
106
|
+
color: disabled ? color : theme.tokens.content.secondary
|
|
107
|
+
},
|
|
108
|
+
indicators: {
|
|
109
|
+
marginInlineStart: theme.space.sm,
|
|
110
|
+
marginInlineEnd: form.paddingRight
|
|
111
|
+
},
|
|
112
|
+
clearIcon: {
|
|
113
|
+
width: 10,
|
|
114
|
+
height: 10
|
|
115
|
+
},
|
|
116
|
+
chip: {
|
|
117
|
+
display: 'flex',
|
|
118
|
+
alignItems: 'center',
|
|
119
|
+
borderRadius: 4,
|
|
120
|
+
border: `1px solid ${border}`,
|
|
121
|
+
background: theme.tokens.background.primary,
|
|
122
|
+
boxShadow: `0 1px 0 0 ${border}`,
|
|
123
|
+
marginBlock: 2
|
|
124
|
+
},
|
|
125
|
+
chipLabel: {
|
|
126
|
+
display: 'flex',
|
|
127
|
+
alignItems: 'center',
|
|
128
|
+
minHeight: chipLabelHeights[size],
|
|
129
|
+
paddingInlineEnd: 'md' === size ? theme.space.xs : theme.space['2xs'],
|
|
130
|
+
paddingInlineStart: theme.space[size]
|
|
131
|
+
},
|
|
132
|
+
chipRemove: {
|
|
133
|
+
display: 'flex',
|
|
134
|
+
alignItems: 'center',
|
|
135
|
+
alignSelf: 'stretch',
|
|
136
|
+
padding: `0 ${theme.space.xs}`,
|
|
137
|
+
paddingRight: theme.space[size],
|
|
138
|
+
border: 0,
|
|
139
|
+
background: 'transparent',
|
|
140
|
+
color: 'inherit',
|
|
141
|
+
cursor: 'pointer',
|
|
142
|
+
':hover': {
|
|
143
|
+
background: theme.tokens.interactive.transparent.neutral.background.hover
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
chipRemoveIcon: {
|
|
147
|
+
width: 8,
|
|
148
|
+
height: 8
|
|
149
|
+
},
|
|
150
|
+
menu: {
|
|
151
|
+
background: theme.tokens.background.primary,
|
|
152
|
+
borderRadius: theme.radius.md,
|
|
153
|
+
border: `1px solid ${border}`,
|
|
154
|
+
minWidth: '100%',
|
|
155
|
+
width: 'max-content',
|
|
156
|
+
maxHeight: 'inherit',
|
|
157
|
+
display: 'flex',
|
|
158
|
+
flexDirection: 'column'
|
|
159
|
+
},
|
|
160
|
+
menuList: {
|
|
161
|
+
listStyle: 'none',
|
|
162
|
+
margin: 0,
|
|
163
|
+
padding: '4px 0',
|
|
164
|
+
overflowY: 'auto'
|
|
165
|
+
},
|
|
166
|
+
heading: {
|
|
167
|
+
fontWeight: 600,
|
|
168
|
+
lineHeight: 1.5,
|
|
169
|
+
color: theme.tokens.content.secondary,
|
|
170
|
+
padding: `${theme.space.xs} ${theme.space.lg}`,
|
|
171
|
+
':empty': {
|
|
172
|
+
display: 'none'
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
message: {
|
|
176
|
+
padding: theme.space.md,
|
|
177
|
+
color: theme.tokens.content.disabled,
|
|
178
|
+
textAlign: 'center'
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
export { CheckWrap, getSelectStyles };
|
package/dist/select/types.d.ts
CHANGED
|
@@ -4,9 +4,6 @@ import type { SelectValue } from '../menu/index.js';
|
|
|
4
4
|
export type { SelectValue } from '../menu/index.js';
|
|
5
5
|
/** Content components receive public option data, without implementation props. */
|
|
6
6
|
export interface SelectComponents<Option extends SelectValue<any> = SelectValue<any>> {
|
|
7
|
-
Indicators?: React.ComponentType<{
|
|
8
|
-
children: React.ReactNode;
|
|
9
|
-
}> | null;
|
|
10
7
|
MultiValueLabel?: React.ComponentType<{
|
|
11
8
|
children: React.ReactNode;
|
|
12
9
|
option: Option;
|
|
@@ -51,10 +48,12 @@ interface SelectStyleState {
|
|
|
51
48
|
isDisabled?: boolean;
|
|
52
49
|
isSelected?: boolean;
|
|
53
50
|
}
|
|
54
|
-
type SelectStyleSlot = 'container' | 'control' | '
|
|
51
|
+
type SelectStyleSlot = 'container' | 'control' | 'input' | 'menu' | 'menuPortal' | 'multiValue' | 'multiValueLabel' | 'multiValueRemove' | 'option' | 'placeholder' | 'singleValue';
|
|
52
|
+
type SelectStyleSlotState<Slot extends SelectStyleSlot, TOption> = Slot extends 'option' | 'singleValue' | 'multiValue' | 'multiValueLabel' | 'multiValueRemove' ? SelectStyleState & {
|
|
53
|
+
data: TOption;
|
|
54
|
+
} : Slot extends 'control' | 'container' ? Pick<SelectStyleState, 'isDisabled'> : unknown;
|
|
55
55
|
/** Style overrides receive CSS and selection state, without implementation components. */
|
|
56
56
|
export type StylesConfig<TValue = unknown, TOption extends SelectValue<TValue> = SelectValue<TValue>> = {
|
|
57
|
-
[Slot in SelectStyleSlot]?: (base: CSSObject, state: Slot
|
|
58
|
-
data: TOption;
|
|
59
|
-
} : Slot extends 'control' | 'container' ? Pick<SelectStyleState, 'isDisabled'> : unknown) => CSSObject;
|
|
57
|
+
[Slot in SelectStyleSlot]?: (base: CSSObject, state: SelectStyleSlotState<Slot, TOption>) => CSSObject;
|
|
60
58
|
};
|
|
59
|
+
export declare function applyStyleSlot<TValue, TOption extends SelectValue<TValue>, Slot extends SelectStyleSlot>(styles: StylesConfig<TValue, TOption> | undefined, slot: Slot, base: CSSObject, state: SelectStyleSlotState<NoInfer<Slot>, NoInfer<TOption>>): CSSObject;
|
package/dist/select/types.js
CHANGED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export declare function isRenderable(node: ReactNode): node is string | number | bigint | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | import("react").ReactPortal | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as React from 'react';
|
|
2
2
|
import type { ContainerProps } from '../layout/container.js';
|
|
3
|
-
export type SeparatorProps = Pick<ContainerProps, '
|
|
3
|
+
export type SeparatorProps = Pick<ContainerProps, 'borderColor' | 'margin' | 'padding'> & {
|
|
4
4
|
orientation: 'horizontal' | 'vertical';
|
|
5
5
|
children?: never;
|
|
6
6
|
} & Omit<React.HTMLAttributes<HTMLHRElement>, 'aria-orientation'>;
|
|
@@ -8,7 +8,7 @@ export type SeparatorProps = Pick<ContainerProps, 'border' | 'margin' | 'padding
|
|
|
8
8
|
* We require a wrapper if we want to use the orientation context,
|
|
9
9
|
* otherwise the styling won't work as override needs to come from the parent.
|
|
10
10
|
*/
|
|
11
|
-
export declare const Separator: import("@emotion/styled").StyledComponent<Pick<ContainerProps, "
|
|
11
|
+
export declare const Separator: import("@emotion/styled").StyledComponent<Pick<ContainerProps, "borderColor" | "margin" | "padding"> & {
|
|
12
12
|
orientation: "horizontal" | "vertical";
|
|
13
13
|
children?: never;
|
|
14
14
|
} & Omit<React.HTMLAttributes<HTMLHRElement>, "aria-orientation"> & {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import is_prop_valid from "@emotion/is-prop-valid";
|
|
3
3
|
import styled from "@emotion/styled";
|
|
4
|
-
import {
|
|
4
|
+
import { getBorderEdge, getMargin, getSpacing, rc } from "../layout/styles.js";
|
|
5
5
|
const omitSeparatorProps = new Set([
|
|
6
|
-
'
|
|
6
|
+
'borderColor'
|
|
7
7
|
]);
|
|
8
8
|
const Separator = styled(({ orientation, ...props })=>/*#__PURE__*/ jsx("hr", {
|
|
9
9
|
"aria-orientation": orientation,
|
|
@@ -24,6 +24,7 @@ const Separator = styled(({ orientation, ...props })=>/*#__PURE__*/ jsx("hr", {
|
|
|
24
24
|
align-self: stretch;
|
|
25
25
|
|
|
26
26
|
border: none;
|
|
27
|
-
${(p)=>
|
|
27
|
+
${(p)=>getBorderEdge('horizontal' === p.orientation ? 'border-bottom' : 'border-left', p.borderColor ?? 'primary', p.theme)};
|
|
28
|
+
border-width: ${(p)=>p.theme.border.md};
|
|
28
29
|
`;
|
|
29
30
|
export { Separator };
|
package/dist/slot/slot.js
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import { createContext, use, useCallback, useContext, useLayoutEffect, useMemo, useReducer, useRef, useState } from "react";
|
|
3
3
|
import { createPortal } from "react-dom";
|
|
4
|
+
import { useDiagnostics } from "../diagnostics/context.js";
|
|
4
5
|
import { KNOWN_BRIDGED_CONTEXTS } from "./knownContexts.js";
|
|
5
|
-
import * as __rspack_external__sentry_react_f0cda475 from "@sentry/react";
|
|
6
6
|
const NOOP_REF_CALLBACK = ()=>{};
|
|
7
7
|
const EMPTY_STATE = {};
|
|
8
8
|
const NOOP_DISPATCH = ()=>{};
|
|
9
9
|
const reportedSlotWarnings = new Set();
|
|
10
|
-
function reportSlotWarning(type, component, slotName, message) {
|
|
10
|
+
function reportSlotWarning(diagnostics, type, component, slotName, message) {
|
|
11
11
|
const key = `${type}:${component}:${slotName}`;
|
|
12
12
|
if (reportedSlotWarnings.has(key)) return;
|
|
13
13
|
reportedSlotWarnings.add(key);
|
|
14
14
|
if ('production' !== process.env.NODE_ENV) return void console.warn(message);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
diagnostics.captureException(new Error(message), {
|
|
16
|
+
level: 'warning',
|
|
17
|
+
tags: {
|
|
18
|
+
'slot.component': component,
|
|
19
|
+
'slot.name': slotName
|
|
20
|
+
},
|
|
21
|
+
fingerprint: [
|
|
20
22
|
`slot-${type}`,
|
|
21
23
|
component,
|
|
22
24
|
slotName
|
|
23
|
-
]
|
|
24
|
-
__rspack_external__sentry_react_f0cda475.captureException(new Error(message));
|
|
25
|
+
]
|
|
25
26
|
});
|
|
26
27
|
}
|
|
27
28
|
function makeSlotReducer() {
|
|
@@ -120,6 +121,7 @@ function makeSlotConsumer(options) {
|
|
|
120
121
|
const { context, outletNameContext } = options;
|
|
121
122
|
function SlotConsumer(props) {
|
|
122
123
|
const ctx = useContext(context);
|
|
124
|
+
const diagnostics = useDiagnostics();
|
|
123
125
|
const [state, dispatch] = ctx ?? [
|
|
124
126
|
EMPTY_STATE,
|
|
125
127
|
NOOP_DISPATCH
|
|
@@ -141,7 +143,7 @@ function makeSlotConsumer(options) {
|
|
|
141
143
|
name
|
|
142
144
|
]);
|
|
143
145
|
if (!ctx) {
|
|
144
|
-
reportSlotWarning('missing-provider', 'Consumer', name, `<Slot.Consumer> for slot "${name}" rendered without a <Slot.Provider>`);
|
|
146
|
+
reportSlotWarning(diagnostics, 'missing-provider', 'Consumer', name, `<Slot.Consumer> for slot "${name}" rendered without a <Slot.Provider>`);
|
|
145
147
|
return null;
|
|
146
148
|
}
|
|
147
149
|
if (!element) return null;
|
|
@@ -162,6 +164,7 @@ function makeSlotConsumer(options) {
|
|
|
162
164
|
function makeSlotOutlet(context, outletNameContext) {
|
|
163
165
|
function SlotOutlet(props) {
|
|
164
166
|
const ctx = useContext(context);
|
|
167
|
+
const diagnostics = useDiagnostics();
|
|
165
168
|
const [, dispatch] = ctx ?? [
|
|
166
169
|
EMPTY_STATE,
|
|
167
170
|
NOOP_DISPATCH
|
|
@@ -199,7 +202,7 @@ function makeSlotOutlet(context, outletNameContext) {
|
|
|
199
202
|
name
|
|
200
203
|
]);
|
|
201
204
|
if (!ctx) {
|
|
202
|
-
reportSlotWarning('missing-provider', 'Outlet', name, `<Slot.Outlet> for slot "${name}" rendered without a <Slot.Provider>`);
|
|
205
|
+
reportSlotWarning(diagnostics, 'missing-provider', 'Outlet', name, `<Slot.Outlet> for slot "${name}" rendered without a <Slot.Provider>`);
|
|
203
206
|
return props.children({
|
|
204
207
|
ref: NOOP_REF_CALLBACK
|
|
205
208
|
}, false);
|
|
@@ -217,9 +220,10 @@ function makeSlotOutlet(context, outletNameContext) {
|
|
|
217
220
|
function makeSlotFallback(context, outletNameContext) {
|
|
218
221
|
function SlotFallback({ children }) {
|
|
219
222
|
const ctx = useContext(context);
|
|
223
|
+
const diagnostics = useDiagnostics();
|
|
220
224
|
const name = useContext(outletNameContext);
|
|
221
225
|
if (!ctx) {
|
|
222
|
-
reportSlotWarning('missing-provider', 'Fallback', name ?? 'unknown', `<Slot.Fallback> for slot "${name ?? 'unknown'}" rendered without a <Slot.Provider>`);
|
|
226
|
+
reportSlotWarning(diagnostics, 'missing-provider', 'Fallback', name ?? 'unknown', `<Slot.Fallback> for slot "${name ?? 'unknown'}" rendered without a <Slot.Provider>`);
|
|
223
227
|
return null;
|
|
224
228
|
}
|
|
225
229
|
if (null === name) throw new Error('Slot.Fallback must be rendered inside Slot.Outlet');
|
package/dist/tabs/tab.js
CHANGED
|
@@ -45,7 +45,9 @@ const innerWrapStyles = ({ theme, orientation, variant, size, selected })=>css`
|
|
|
45
45
|
line-height: ${theme.form[size].lineHeight};
|
|
46
46
|
padding: ${paddingPerSize(theme, orientation)[size]};
|
|
47
47
|
border-radius: ${theme.radius.md};
|
|
48
|
-
|
|
48
|
+
/* The nudge positions the selection indicator, which only flat tabs have.
|
|
49
|
+
Floating tabs stay centered so they line up with controls next to them. */
|
|
50
|
+
transform: ${'flat' === variant ? 'translateY(1px)' : 'none'};
|
|
49
51
|
margin-bottom: ${'horizontal' === orientation && 'flat' === variant ? theme.space.xs : 0};
|
|
50
52
|
|
|
51
53
|
${'horizontal' === orientation ? css`
|
package/dist/theme/index.d.ts
CHANGED
|
@@ -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';
|
package/dist/theme/index.js
CHANGED
|
@@ -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";
|
package/dist/theme/types.d.ts
CHANGED
|
@@ -72,6 +72,7 @@ export type BorderVariant = BorderToken | 'none';
|
|
|
72
72
|
* this type.
|
|
73
73
|
*/
|
|
74
74
|
export type BackgroundToken = TokenPath<(typeof lightTheme)['tokens']['background']>;
|
|
75
|
+
export type BorderWidthToken = keyof (typeof lightTheme)['border'];
|
|
75
76
|
/**
|
|
76
77
|
* Icon size constraint.
|
|
77
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 };
|