@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,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
+ };
@@ -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
- export { CheckWrap };
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 };
@@ -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' | 'groupHeading' | 'input' | 'menu' | 'menuList' | 'menuPortal' | 'multiValue' | 'multiValueLabel' | 'multiValueRemove' | 'option' | 'placeholder' | 'singleValue';
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 extends 'option' | 'singleValue' | 'multiValue' | 'multiValueLabel' | 'multiValueRemove' ? SelectStyleState & {
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;
@@ -0,0 +1,4 @@
1
+ function applyStyleSlot(styles, slot, base, state) {
2
+ return styles?.[slot]?.(base, state) ?? base;
3
+ }
4
+ export { applyStyleSlot };
@@ -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>;
@@ -0,0 +1,4 @@
1
+ function isRenderable(node) {
2
+ return null != node && 'boolean' != typeof node;
3
+ }
4
+ export { isRenderable };
@@ -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, 'border' | 'margin' | 'padding'> & {
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, "border" | "margin" | "padding"> & {
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 { getBorder, getMargin, getSpacing, rc } from "../layout/styles.js";
4
+ import { getBorderEdge, getMargin, getSpacing, rc } from "../layout/styles.js";
5
5
  const omitSeparatorProps = new Set([
6
- 'border'
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)=>rc('horizontal' === p.orientation ? 'border-bottom' : 'border-left', p.border ?? 'primary', p.theme, (...args)=>`${getBorder(...args)} !important`)};
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
- __rspack_external__sentry_react_f0cda475.withScope((scope)=>{
16
- scope.setLevel('warning');
17
- scope.setTag('slot.component', component);
18
- scope.setTag('slot.name', slotName);
19
- scope.setFingerprint([
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');
@@ -0,0 +1,9 @@
1
+ import type { TabListState } from '@react-stately/tabs';
2
+ import type { InternalTabsProps } from './tabs.js';
3
+ interface TabContext {
4
+ rootProps: Omit<InternalTabsProps, 'children'> & Required<Pick<InternalTabsProps, 'orientation' | 'size'>>;
5
+ setTabListState: (state: TabListState<any>) => void;
6
+ tabListState?: TabListState<any>;
7
+ }
8
+ export declare const TabsContext: import("react").Context<TabContext>;
9
+ export {};
@@ -0,0 +1,9 @@
1
+ import { createContext } from "react";
2
+ const TabsContext = /*#__PURE__*/ createContext({
3
+ rootProps: {
4
+ orientation: 'horizontal',
5
+ size: 'md'
6
+ },
7
+ setTabListState: ()=>{}
8
+ });
9
+ export { TabsContext };
@@ -1,4 +1,2 @@
1
- export { Tabs, TabStateProvider } from './tabs.js';
2
- export { TabList } from './tabList.js';
3
- export { type TabListItemProps } from './item.js';
4
- export { TabPanels } from './tabPanels.js';
1
+ export { Tabs, LinkTabs, type TabKey, type TabsComponents, type TabsProps, type LinkTabsComponents, type LinkTabsProps, } from './tabs.js';
2
+ export type { TabListItemProps, LinkTabListItemProps, TabPanelItemProps } from './item.js';
@@ -1,3 +1 @@
1
- export { TabStateProvider, Tabs } from "./tabs.js";
2
- export { TabList } from "./tabList.js";
3
- export { TabPanels } from "./tabPanels.js";
1
+ export { LinkTabs, Tabs } from "./tabs.js";
@@ -2,12 +2,23 @@ import type { JSX } from 'react';
2
2
  import type { ItemProps } from '@react-types/shared';
3
3
  import type { LinkProps } from '../link/index.js';
4
4
  import type { TooltipProps } from '../tooltip/index.js';
5
- export interface TabListItemProps extends ItemProps<any> {
6
- key: string | number;
5
+ import type { TabKey } from './tabs.js';
6
+ interface BaseTabListItemProps<T extends TabKey> extends ItemProps<any> {
7
+ key: T;
7
8
  disabled?: boolean;
8
9
  hidden?: boolean;
9
- to?: LinkProps['to'];
10
10
  tooltip?: TooltipProps;
11
11
  }
12
- export declare const TabListItem: (props: TabListItemProps) => JSX.Element;
13
- export declare const TabPanelItem: (props: ItemProps<any>) => JSX.Element;
12
+ export interface TabListItemProps<T extends TabKey = TabKey> extends BaseTabListItemProps<T> {
13
+ to?: never;
14
+ }
15
+ export interface LinkTabListItemProps<T extends TabKey = TabKey> extends BaseTabListItemProps<T> {
16
+ to: NonNullable<LinkProps['to']>;
17
+ }
18
+ export type InternalTabListItemProps = TabListItemProps | LinkTabListItemProps;
19
+ export interface TabPanelItemProps<T extends TabKey = TabKey> extends ItemProps<any> {
20
+ key: T;
21
+ }
22
+ export declare const TabListItem: (props: InternalTabListItemProps) => JSX.Element;
23
+ export declare const TabPanelItem: (props: TabPanelItemProps) => JSX.Element;
24
+ export {};
package/dist/tabs/tab.js CHANGED
@@ -1,11 +1,12 @@
1
1
  import { jsx, jsxs } from "@emotion/react/jsx-runtime";
2
- import { Fragment, useRef } from "react";
2
+ import { Fragment, useContext, useRef } from "react";
3
3
  import { css } from "@emotion/react";
4
4
  import styled from "@emotion/styled";
5
5
  import { useTab } from "@react-aria/tabs";
6
6
  import { useObjectRef } from "@react-aria/utils";
7
7
  import { Link } from "../link/index.js";
8
8
  import { Tooltip } from "../tooltip/index.js";
9
+ import { TabsContext } from "./context.js";
9
10
  import { isModifiedClick, tabsShouldForwardProp } from "./utils.js";
10
11
  const StyledTabWrap = styled('li', {
11
12
  shouldForwardProp: tabsShouldForwardProp
@@ -44,7 +45,9 @@ const innerWrapStyles = ({ theme, orientation, variant, size, selected })=>css`
44
45
  line-height: ${theme.form[size].lineHeight};
45
46
  padding: ${paddingPerSize(theme, orientation)[size]};
46
47
  border-radius: ${theme.radius.md};
47
- transform: translateY(1px);
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'};
48
51
  margin-bottom: ${'horizontal' === orientation && 'flat' === variant ? theme.space.xs : 0};
49
52
 
50
53
  ${'horizontal' === orientation ? css`
@@ -110,15 +113,16 @@ const StyledTabSelectionIndicator = styled('div')`
110
113
  `}
111
114
  `;
112
115
  function Tab({ ref, item, state, orientation, overflowing, variant = 'flat', size, as = 'li', tooltipProps }) {
116
+ const { rootProps: { onChange } } = useContext(TabsContext);
113
117
  const wrapperRef = useObjectRef(ref);
114
118
  const controlRef = useRef(null);
115
119
  const { key, rendered, props: { to, hidden } } = item;
116
120
  const { tabProps, isSelected, isDisabled } = useTab({
117
121
  key,
118
122
  isDisabled: hidden,
119
- shouldSelectOnPressUp: !!to
123
+ shouldSelectOnPressUp: void 0 !== to
120
124
  }, state, controlRef);
121
- const isLink = !!to && !isDisabled;
125
+ const isLink = void 0 !== to && !isDisabled;
122
126
  const styleProps = {
123
127
  orientation,
124
128
  variant,
@@ -161,6 +165,7 @@ function Tab({ ref, item, state, orientation, overflowing, variant = 'flat', siz
161
165
  if (!isModifiedClick(event)) tabProps.onPointerDown?.(event);
162
166
  },
163
167
  onClick: (event)=>{
168
+ onChange?.(String(key));
164
169
  if (!isModifiedClick(event)) tabProps.onClick?.(event);
165
170
  },
166
171
  onKeyDown: (event)=>{
@@ -1,9 +1,10 @@
1
1
  import type { CSSProperties } from 'react';
2
2
  import type { TabListStateOptions } from '@react-stately/tabs';
3
- import type { TabListItemProps } from './item.js';
3
+ import type { InternalTabListItemProps } from './item.js';
4
4
  import type { TabProps } from './tab.js';
5
- interface TabListProps {
6
- children: TabListStateOptions<TabListItemProps>['children'];
5
+ export interface TabListProps {
6
+ children: TabListStateOptions<InternalTabListItemProps>['children'];
7
+ className?: string;
7
8
  outerWrapStyles?: CSSProperties;
8
9
  variant?: TabProps['variant'];
9
10
  }
@@ -13,6 +14,5 @@ interface TabListProps {
13
14
  */
14
15
  export declare function TabList({ variant, ...props }: TabListProps): import("@emotion/react/jsx-runtime").JSX.Element;
15
16
  export declare namespace TabList {
16
- var Item: (props: TabListItemProps) => import("react").JSX.Element;
17
+ var Item: (props: InternalTabListItemProps) => import("react").JSX.Element;
17
18
  }
18
- export {};