@sentry/scraps 0.1.0 → 0.3.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 (253) hide show
  1. package/README.md +13 -21
  2. package/dist/alert/alert.d.ts +25 -0
  3. package/dist/alert/alert.js +262 -0
  4. package/dist/alert/alertLink.d.ts +32 -0
  5. package/dist/alert/alertLink.js +94 -0
  6. package/dist/alert/index.d.ts +2 -0
  7. package/dist/alert/index.js +2 -0
  8. package/dist/backdrop/backdrop.d.ts +9 -0
  9. package/dist/backdrop/backdrop.js +28 -0
  10. package/dist/backdrop/index.d.ts +1 -0
  11. package/dist/backdrop/index.js +1 -0
  12. package/dist/badge/badge.d.ts +12 -0
  13. package/dist/badge/badge.js +80 -0
  14. package/dist/badge/featureBadge.d.ts +6 -0
  15. package/dist/badge/featureBadge.js +86 -0
  16. package/dist/badge/index.d.ts +3 -0
  17. package/dist/badge/index.js +3 -0
  18. package/dist/badge/tag.d.ts +15 -0
  19. package/dist/badge/tag.js +119 -0
  20. package/dist/boundaryContext.d.ts +2 -0
  21. package/dist/boundaryContext.js +5 -0
  22. package/dist/button/button.d.ts +3 -0
  23. package/dist/button/button.js +83 -0
  24. package/dist/button/buttonBar.d.ts +10 -0
  25. package/dist/button/buttonBar.js +141 -0
  26. package/dist/button/index.d.ts +5 -0
  27. package/dist/button/index.js +4 -0
  28. package/dist/button/linkButton.d.ts +3 -0
  29. package/dist/button/linkButton.js +110 -0
  30. package/dist/button/styles.d.ts +10 -0
  31. package/dist/button/styles.js +247 -0
  32. package/dist/button/types.d.ts +77 -0
  33. package/dist/button/types.js +0 -0
  34. package/dist/button/useButtonFunctionality.d.ts +5 -0
  35. package/dist/button/useButtonFunctionality.js +9 -0
  36. package/dist/checkbox/checkbox.d.ts +20 -0
  37. package/dist/checkbox/checkbox.js +193 -0
  38. package/dist/checkbox/index.d.ts +1 -0
  39. package/dist/checkbox/index.js +1 -0
  40. package/dist/chip/chip.d.ts +128 -0
  41. package/dist/chip/chip.js +364 -0
  42. package/dist/chip/index.d.ts +1 -0
  43. package/dist/chip/index.js +1 -0
  44. package/dist/code/inlineCode.d.ts +1 -0
  45. package/dist/datetime.d.ts +39 -0
  46. package/dist/datetime.js +20 -0
  47. package/dist/descriptionList/descriptionList.d.ts +69 -0
  48. package/dist/descriptionList/descriptionList.js +76 -0
  49. package/dist/descriptionList/index.d.ts +1 -0
  50. package/dist/descriptionList/index.js +1 -0
  51. package/dist/disclosure/disclosure.d.ts +37 -0
  52. package/dist/disclosure/disclosure.js +155 -0
  53. package/dist/disclosure/index.d.ts +1 -0
  54. package/dist/disclosure/index.js +1 -0
  55. package/dist/dragHandle/dragHandle.d.ts +34 -0
  56. package/dist/dragHandle/dragHandle.js +115 -0
  57. package/dist/dragHandle/index.d.ts +4 -0
  58. package/dist/dragHandle/index.js +4 -0
  59. package/dist/dragHandle/setDocumentDragging.d.ts +9 -0
  60. package/dist/dragHandle/setDocumentDragging.js +6 -0
  61. package/dist/dragHandle/useDragMove.d.ts +244 -0
  62. package/dist/dragHandle/useDragMove.js +66 -0
  63. package/dist/dragHandle/useDragSeparator.d.ts +256 -0
  64. package/dist/dragHandle/useDragSeparator.js +36 -0
  65. package/dist/emptyState/emptyState.d.ts +10 -0
  66. package/dist/emptyState/emptyState.js +81 -0
  67. package/dist/emptyState/index.d.ts +1 -0
  68. package/dist/emptyState/index.js +1 -0
  69. package/dist/formPresentation/autoSaveContext.d.ts +23 -0
  70. package/dist/formPresentation/autoSaveContext.js +13 -0
  71. package/dist/formPresentation/base.d.ts +11 -0
  72. package/dist/formPresentation/base.js +37 -0
  73. package/dist/formPresentation/displayField.d.ts +17 -0
  74. package/dist/formPresentation/displayField.js +69 -0
  75. package/dist/formPresentation/fieldIds.d.ts +3 -0
  76. package/dist/formPresentation/fieldIds.js +14 -0
  77. package/dist/formPresentation/fieldLayout.d.ts +23 -0
  78. package/dist/formPresentation/fieldLayout.js +76 -0
  79. package/dist/formPresentation/formContext.d.ts +4 -0
  80. package/dist/formPresentation/formContext.js +6 -0
  81. package/dist/formPresentation/groupContext.d.ts +24 -0
  82. package/dist/formPresentation/groupContext.js +22 -0
  83. package/dist/formPresentation/icons.d.ts +11 -0
  84. package/dist/formPresentation/icons.js +61 -0
  85. package/dist/formPresentation/index.d.ts +8 -0
  86. package/dist/formPresentation/index.js +8 -0
  87. package/dist/formPresentation/meta.d.ts +18 -0
  88. package/dist/formPresentation/meta.js +88 -0
  89. package/dist/formPresentation/useStackedLayout.d.ts +1 -0
  90. package/dist/formPresentation/useStackedLayout.js +9 -0
  91. package/dist/hotkey/hotkey.d.ts +22 -0
  92. package/dist/hotkey/hotkey.js +41 -0
  93. package/dist/hotkey/index.d.ts +4 -0
  94. package/dist/hotkey/index.js +3 -0
  95. package/dist/hotkey/kbd.d.ts +1 -0
  96. package/dist/hotkey/keyMappings.d.ts +23 -0
  97. package/dist/hotkey/keyMappings.js +223 -0
  98. package/dist/hotkey/useHotkeys.d.ts +47 -0
  99. package/dist/hotkey/useHotkeys.js +44 -0
  100. package/dist/image/image.d.ts +21 -0
  101. package/dist/image/image.js +20 -0
  102. package/dist/image/index.d.ts +1 -0
  103. package/dist/image/index.js +1 -0
  104. package/dist/info/index.d.ts +2 -0
  105. package/dist/info/index.js +2 -0
  106. package/dist/info/infoText.d.ts +15 -0
  107. package/dist/info/infoText.js +43 -0
  108. package/dist/info/infoTip.d.ts +10 -0
  109. package/dist/info/infoTip.js +54 -0
  110. package/dist/input/index.d.ts +8 -0
  111. package/dist/input/index.js +6 -0
  112. package/dist/input/input.d.ts +19 -0
  113. package/dist/input/input.js +14 -0
  114. package/dist/input/inputGroup.d.ts +29 -0
  115. package/dist/input/inputGroup.js +167 -0
  116. package/dist/input/inputStyles.d.ts +13 -0
  117. package/dist/input/inputStyles.js +52 -0
  118. package/dist/input/numberDragInput.d.ts +20 -0
  119. package/dist/input/numberDragInput.js +97 -0
  120. package/dist/input/numberInput.d.ts +10 -0
  121. package/dist/input/numberInput.js +94 -0
  122. package/dist/input/otpInput.d.ts +28 -0
  123. package/dist/input/otpInput.js +81 -0
  124. package/dist/input/useAutosizeInput.d.ts +17 -0
  125. package/dist/input/useAutosizeInput.js +56 -0
  126. package/dist/interactionStateLayer/index.d.ts +1 -0
  127. package/dist/interactionStateLayer/index.js +1 -0
  128. package/dist/interactionStateLayer/interactionStateLayer.d.ts +23 -0
  129. package/dist/interactionStateLayer/interactionStateLayer.js +67 -0
  130. package/dist/layout/flex.d.ts +1 -0
  131. package/dist/layout/grid.d.ts +1 -0
  132. package/dist/layout/index.d.ts +1 -1
  133. package/dist/layout/index.js +1 -1
  134. package/dist/layout/stack.d.ts +1 -0
  135. package/dist/layout/styles.d.ts +1 -1
  136. package/dist/layout/surface.d.ts +1 -0
  137. package/dist/link/index.d.ts +2 -0
  138. package/dist/link/index.js +2 -0
  139. package/dist/link/link.d.ts +43 -0
  140. package/dist/link/link.js +71 -0
  141. package/dist/link/linkBehaviorContext.d.ts +14 -0
  142. package/dist/link/linkBehaviorContext.js +31 -0
  143. package/dist/loader/indeterminateLoader.d.ts +1 -0
  144. package/dist/overlay.d.ts +59 -0
  145. package/dist/overlay.js +113 -0
  146. package/dist/overlayArrow.d.ts +9 -0
  147. package/dist/overlayArrow.js +55 -0
  148. package/dist/overlayPositioning.d.ts +70 -0
  149. package/dist/overlayPositioning.js +139 -0
  150. package/dist/panelProvider.d.ts +8 -0
  151. package/dist/panelProvider.js +20 -0
  152. package/dist/quote/quote.js +1 -1
  153. package/dist/radio/index.d.ts +1 -0
  154. package/dist/radio/index.js +1 -0
  155. package/dist/radio/radio.d.ts +9 -0
  156. package/dist/radio/radio.js +77 -0
  157. package/dist/renderToString.d.ts +2 -0
  158. package/dist/renderToString.js +25 -0
  159. package/dist/revealOnHover/index.d.ts +1 -0
  160. package/dist/revealOnHover/index.js +1 -0
  161. package/dist/revealOnHover/revealOnHover.d.ts +20 -0
  162. package/dist/revealOnHover/revealOnHover.js +62 -0
  163. package/dist/segmentedControl/index.d.ts +1 -0
  164. package/dist/segmentedControl/index.js +1 -0
  165. package/dist/segmentedControl/segmentedControl.d.ts +41 -0
  166. package/dist/segmentedControl/segmentedControl.js +217 -0
  167. package/dist/separator/separator.d.ts +4 -3
  168. package/dist/separator/separator.js +1 -1
  169. package/dist/sizeContext.d.ts +9 -0
  170. package/dist/sizeContext.js +13 -0
  171. package/dist/slider/index.d.ts +1 -0
  172. package/dist/slider/index.js +1 -0
  173. package/dist/slider/slider.d.ts +41 -0
  174. package/dist/slider/slider.js +386 -0
  175. package/dist/slot/index.d.ts +1 -0
  176. package/dist/slot/index.js +1 -0
  177. package/dist/slot/knownContexts.d.ts +1 -0
  178. package/dist/slot/knownContexts.js +7 -0
  179. package/dist/slot/slot.d.ts +26 -0
  180. package/dist/slot/slot.js +274 -0
  181. package/dist/statusIndicator/index.d.ts +1 -0
  182. package/dist/statusIndicator/index.js +1 -0
  183. package/dist/statusIndicator/statusIndicator.d.ts +24 -0
  184. package/dist/statusIndicator/statusIndicator.js +130 -0
  185. package/dist/switch/index.d.ts +1 -0
  186. package/dist/switch/index.js +1 -0
  187. package/dist/switch/switch.d.ts +6 -0
  188. package/dist/switch/switch.js +172 -0
  189. package/dist/table/index.d.ts +3 -0
  190. package/dist/table/index.js +3 -0
  191. package/dist/table/sortableHeaderCell.d.ts +36 -0
  192. package/dist/table/sortableHeaderCell.js +99 -0
  193. package/dist/table/styles.d.ts +46 -0
  194. package/dist/table/styles.js +93 -0
  195. package/dist/table/table.d.ts +64 -0
  196. package/dist/table/table.js +228 -0
  197. package/dist/table/useColumnResize.d.ts +27 -0
  198. package/dist/table/useColumnResize.js +62 -0
  199. package/dist/table/useObservedColumnSize.d.ts +12 -0
  200. package/dist/table/useObservedColumnSize.js +74 -0
  201. package/dist/text/heading.d.ts +2 -1
  202. package/dist/text/index.d.ts +1 -0
  203. package/dist/text/index.js +1 -0
  204. package/dist/text/prose.d.ts +8 -0
  205. package/dist/text/prose.js +45 -0
  206. package/dist/text/text.d.ts +8 -0
  207. package/dist/text/text.js +1 -1
  208. package/dist/textarea/index.d.ts +1 -0
  209. package/dist/textarea/index.js +1 -0
  210. package/dist/textarea/textarea.d.ts +22 -0
  211. package/dist/textarea/textarea.js +77 -0
  212. package/dist/theme/dark.d.ts +129 -10
  213. package/dist/theme/dark.js +41 -13
  214. package/dist/theme/index.d.ts +3 -12
  215. package/dist/theme/index.js +2 -2
  216. package/dist/theme/light.d.ts +129 -10
  217. package/dist/theme/light.js +42 -14
  218. package/dist/theme/swatch.d.ts +27 -0
  219. package/dist/theme/swatch.js +37 -0
  220. package/dist/theme/theme.d.ts +648 -0
  221. package/dist/theme/theme.js +780 -0
  222. package/dist/theme/types.d.ts +1 -0
  223. package/dist/theme/useInvertedTheme.d.ts +1 -0
  224. package/dist/theme/useInvertedTheme.js +7 -0
  225. package/dist/tooltip/index.d.ts +2 -0
  226. package/dist/tooltip/index.js +2 -0
  227. package/dist/tooltip/tooltip.d.ts +166 -0
  228. package/dist/tooltip/tooltip.js +181 -0
  229. package/dist/tooltip/useDisabledTooltip.d.ts +22 -0
  230. package/dist/tooltip/useDisabledTooltip.js +24 -0
  231. package/dist/trackingContext.d.ts +34 -0
  232. package/dist/trackingContext.js +29 -0
  233. package/dist/translation/index.d.ts +4 -0
  234. package/dist/translation/index.js +4 -0
  235. package/dist/translation/translationContext.d.ts +6 -0
  236. package/dist/translation/translationContext.js +6 -0
  237. package/dist/translation/useTranslation.d.ts +1 -0
  238. package/dist/translation/useTranslation.js +6 -0
  239. package/dist/unreachable.d.ts +1 -0
  240. package/dist/unreachable.js +4 -0
  241. package/dist/useHoverOverlay.d.ts +113 -0
  242. package/dist/useHoverOverlay.js +370 -0
  243. package/dist/useIsInsideInteractiveElement.d.ts +6 -0
  244. package/dist/useIsInsideInteractiveElement.js +31 -0
  245. package/dist/useOverlay.d.ts +82 -0
  246. package/dist/useOverlay.js +217 -0
  247. package/dist/useScrollLock.d.ts +5 -0
  248. package/dist/useScrollLock.js +100 -0
  249. package/dist/useStableMergeRef.d.ts +9 -0
  250. package/dist/useStableMergeRef.js +18 -0
  251. package/package.json +219 -11
  252. package/dist/index.d.ts +0 -9
  253. package/dist/index.js +0 -9
@@ -0,0 +1,223 @@
1
+ import { jsx } from "@emotion/react/jsx-runtime";
2
+ import { isMac } from "@react-aria/utils";
3
+ import { IconArrow } from "@sentry/icons/arrow";
4
+ import { IconCommand } from "@sentry/icons/command";
5
+ import { IconControl } from "@sentry/icons/control";
6
+ import { IconOption } from "@sentry/icons/option";
7
+ import { IconReturn } from "@sentry/icons/return";
8
+ import { IconShift } from "@sentry/icons/shift";
9
+ import * as __rspack_external__sentry_react_f0cda475 from "@sentry/react";
10
+ const aliases = {
11
+ cmd: 'command',
12
+ meta: 'command',
13
+ '\u2318': 'command',
14
+ ctrl: 'control',
15
+ '\u2303': 'control',
16
+ option: 'alt',
17
+ '\u2325': 'alt',
18
+ '\u21E7': 'shift',
19
+ return: 'enter',
20
+ esc: 'escape',
21
+ del: 'delete',
22
+ ins: 'insert',
23
+ '\u21EA': 'capslock'
24
+ };
25
+ function canonicalize(keyName) {
26
+ const lower = keyName.toLowerCase();
27
+ if ('mod' === lower) return isMac() ? 'command' : 'control';
28
+ return aliases[lower] ?? lower;
29
+ }
30
+ const namedKeyMap = {
31
+ backspace: 'Backspace',
32
+ tab: 'Tab',
33
+ clear: 'Clear',
34
+ enter: 'Enter',
35
+ escape: 'Escape',
36
+ space: ' ',
37
+ left: 'ArrowLeft',
38
+ up: 'ArrowUp',
39
+ right: 'ArrowRight',
40
+ down: 'ArrowDown',
41
+ delete: 'Delete',
42
+ insert: 'Insert',
43
+ home: 'Home',
44
+ end: 'End',
45
+ pageup: 'PageUp',
46
+ pagedown: 'PageDown',
47
+ capslock: 'CapsLock'
48
+ };
49
+ const punctuationCodeMap = {
50
+ ',': 'Comma',
51
+ '.': 'Period',
52
+ '/': 'Slash',
53
+ '`': 'Backquote',
54
+ '-': 'Minus',
55
+ '=': 'Equal',
56
+ ';': 'Semicolon',
57
+ "'": 'Quote',
58
+ '[': 'BracketLeft',
59
+ ']': 'BracketRight',
60
+ '\\': 'Backslash'
61
+ };
62
+ const modifierPredicates = {
63
+ command: (e)=>e.metaKey,
64
+ shift: (e)=>e.shiftKey,
65
+ control: (e)=>e.ctrlKey,
66
+ alt: (e)=>e.altKey
67
+ };
68
+ const MODIFIER_KEYS = [
69
+ 'command',
70
+ 'shift',
71
+ 'control',
72
+ 'alt'
73
+ ];
74
+ function codeForChar(ch) {
75
+ if (ch >= 'a' && ch <= 'z') return `Key${ch.toUpperCase()}`;
76
+ if (ch >= '0' && ch <= '9') return `Digit${ch}`;
77
+ return punctuationCodeMap[ch];
78
+ }
79
+ function matchesKey(name, event) {
80
+ const key = canonicalize(name);
81
+ const modifier = modifierPredicates[key];
82
+ if (modifier) return modifier(event);
83
+ const namedKey = namedKeyMap[key];
84
+ if (namedKey) return event.key === namedKey;
85
+ if (1 === key.length) {
86
+ if (event.key?.toLowerCase() === key) return true;
87
+ const code = codeForChar(key);
88
+ if (code && event.code === code) {
89
+ const eventKey = event.key;
90
+ if (eventKey?.length !== 1 || eventKey.charCodeAt(0) > 0x7f) return true;
91
+ if (event.shiftKey) return true;
92
+ }
93
+ }
94
+ return false;
95
+ }
96
+ const sharedProps = {
97
+ size: 'xs'
98
+ };
99
+ const macGlyphs = {
100
+ command: {
101
+ icon: /*#__PURE__*/ jsx(IconCommand, {
102
+ ...sharedProps
103
+ }),
104
+ label: '\u2318'
105
+ },
106
+ control: {
107
+ icon: /*#__PURE__*/ jsx(IconControl, {
108
+ ...sharedProps
109
+ }),
110
+ label: '\u2303'
111
+ },
112
+ alt: {
113
+ icon: /*#__PURE__*/ jsx(IconOption, {
114
+ ...sharedProps
115
+ }),
116
+ label: '\u2325'
117
+ }
118
+ };
119
+ const otherGlyphs = {
120
+ command: {
121
+ label: 'Ctrl'
122
+ },
123
+ control: {
124
+ label: 'Ctrl'
125
+ },
126
+ alt: {
127
+ label: 'Alt'
128
+ }
129
+ };
130
+ const universalGlyphs = {
131
+ shift: {
132
+ icon: /*#__PURE__*/ jsx(IconShift, {
133
+ ...sharedProps
134
+ }),
135
+ label: '\u21E7'
136
+ },
137
+ enter: {
138
+ icon: /*#__PURE__*/ jsx(IconReturn, {
139
+ ...sharedProps
140
+ }),
141
+ label: '\u21B5'
142
+ },
143
+ left: {
144
+ icon: /*#__PURE__*/ jsx(IconArrow, {
145
+ ...sharedProps,
146
+ direction: "left"
147
+ }),
148
+ label: '\u2190'
149
+ },
150
+ right: {
151
+ icon: /*#__PURE__*/ jsx(IconArrow, {
152
+ ...sharedProps,
153
+ direction: "right"
154
+ }),
155
+ label: '\u2192'
156
+ },
157
+ up: {
158
+ icon: /*#__PURE__*/ jsx(IconArrow, {
159
+ ...sharedProps,
160
+ direction: "up"
161
+ }),
162
+ label: '\u2191'
163
+ },
164
+ down: {
165
+ icon: /*#__PURE__*/ jsx(IconArrow, {
166
+ ...sharedProps,
167
+ direction: "down"
168
+ }),
169
+ label: '\u2193'
170
+ },
171
+ backspace: {
172
+ label: '\u232B'
173
+ },
174
+ delete: {
175
+ label: 'Del'
176
+ },
177
+ tab: {
178
+ label: 'Tab'
179
+ },
180
+ escape: {
181
+ label: 'Esc'
182
+ },
183
+ space: {
184
+ label: 'Space'
185
+ },
186
+ home: {
187
+ label: 'Home'
188
+ },
189
+ end: {
190
+ label: 'End'
191
+ },
192
+ pageup: {
193
+ label: 'PageUp'
194
+ },
195
+ pagedown: {
196
+ label: 'PageDown'
197
+ },
198
+ insert: {
199
+ label: 'Insert'
200
+ },
201
+ clear: {
202
+ label: 'Clear'
203
+ },
204
+ capslock: {
205
+ label: 'CapsLock'
206
+ }
207
+ };
208
+ function resolveKeyGlyph(keyName) {
209
+ const key = canonicalize(keyName);
210
+ const platformGlyphs = isMac() ? macGlyphs : otherGlyphs;
211
+ const glyph = platformGlyphs[key] ?? universalGlyphs[key];
212
+ if (glyph) return glyph;
213
+ if (key.length > 1) {
214
+ if ('production' !== process.env.NODE_ENV) throw new Error(`Missing key glyph mapping for "${keyName}"`);
215
+ __rspack_external__sentry_react_f0cda475.logger.warn('Missing key glyph mapping', {
216
+ keyName
217
+ });
218
+ }
219
+ return {
220
+ label: keyName.replace(/\w\S*/g, (word)=>word.charAt(0).toUpperCase() + word.substring(1))
221
+ };
222
+ }
223
+ export { MODIFIER_KEYS, canonicalize, matchesKey, resolveKeyGlyph };
@@ -0,0 +1,47 @@
1
+ type Hotkey = {
2
+ /**
3
+ * The callback triggered when the matching key is pressed
4
+ */
5
+ callback: (e: KeyboardEvent) => void;
6
+ /**
7
+ * Defines the matching shortcuts.
8
+ *
9
+ * Multiple shortcuts may be passed as a list.
10
+ *
11
+ * The format for shorcuts is `<modifiers>+<key>` For example `shift+t` or
12
+ * `command+shift+t`.
13
+ */
14
+ match: string[] | string;
15
+ /**
16
+ * When `false`, the hotkey is skipped: the callback never fires and
17
+ * `preventDefault` is never called. Useful for gating a hotkey on state
18
+ * (e.g. only intercept `Escape` while a panel is open) without rebuilding
19
+ * the hotkey array. Defaults to `true`.
20
+ */
21
+ enabled?: boolean;
22
+ /**
23
+ * Allow shortcuts to be triggered while a text input is foccused
24
+ */
25
+ includeInputs?: boolean;
26
+ /**
27
+ * Do not call preventDefault on the keydown event
28
+ */
29
+ skipPreventDefault?: boolean;
30
+ };
31
+ /**
32
+ * Returns whether an event should trigger one of the supplied hotkey matches.
33
+ * Uses the same platform-aware modifier and keyboard-layout behavior as
34
+ * useHotkeys, and never matches while an IME is composing text.
35
+ */
36
+ export declare function matchesHotkey(match: string[] | string, event: KeyboardEvent): boolean;
37
+ /**
38
+ * Pass in the hotkey combinations under match and the corresponding callback
39
+ * function to be called. Separate key names with +. For example,
40
+ * 'command+alt+shift+x'
41
+ *
42
+ * Alternate matchings as an array: ['command+alt+backspace', 'ctrl+alt+delete']
43
+ *
44
+ * Note: you can only use one non-modifier (keys other than shift, ctrl, alt, command) key at a time.
45
+ */
46
+ export declare function useHotkeys(hotkeys: Hotkey[]): void;
47
+ export {};
@@ -0,0 +1,44 @@
1
+ import { useEffect, useRef } from "react";
2
+ import { MODIFIER_KEYS, canonicalize, matchesKey } from "./keyMappings.js";
3
+ function shouldIgnoreHotkeyEvent(event) {
4
+ return event.isComposing;
5
+ }
6
+ function matchesHotkey(match, event) {
7
+ if (shouldIgnoreHotkeyEvent(event)) return false;
8
+ return (Array.isArray(match) ? match : [
9
+ match
10
+ ]).some((keyset)=>{
11
+ const keys = keyset.toLowerCase().split('+').map((key)=>canonicalize(key));
12
+ const unusedModifiers = MODIFIER_KEYS.filter((modifier)=>!keys.includes(modifier));
13
+ return keys.every((key)=>matchesKey(key, event)) && unusedModifiers.every((modifier)=>!matchesKey(modifier, event));
14
+ });
15
+ }
16
+ function useHotkeys(hotkeys) {
17
+ const hotkeysRef = useRef(hotkeys);
18
+ useEffect(()=>{
19
+ hotkeysRef.current = hotkeys;
20
+ });
21
+ useEffect(()=>{
22
+ const onKeyDown = (evt)=>{
23
+ if (shouldIgnoreHotkeyEvent(evt)) return;
24
+ for (const hotkey of hotkeysRef.current){
25
+ if (false === hotkey.enabled) continue;
26
+ const preventDefault = !hotkey.skipPreventDefault;
27
+ const inputHasFocus = !hotkey.includeInputs && evt.target instanceof HTMLElement ? evt.target.isContentEditable || [
28
+ 'textarea',
29
+ 'input'
30
+ ].includes(evt.target.tagName.toLowerCase()) : false;
31
+ if (matchesHotkey(hotkey.match, evt) && !inputHasFocus) {
32
+ if (preventDefault) evt.preventDefault();
33
+ hotkey.callback(evt);
34
+ return;
35
+ }
36
+ }
37
+ };
38
+ document.addEventListener('keydown', onKeyDown);
39
+ return ()=>{
40
+ document.removeEventListener('keydown', onKeyDown);
41
+ };
42
+ }, []);
43
+ }
44
+ export { matchesHotkey, useHotkeys };
@@ -0,0 +1,21 @@
1
+ import type * as React from 'react';
2
+ import type { CSS } from '../cssTypes.js';
3
+ import type { Responsive } from '../layout/index.js';
4
+ import type { RadiusSize } from '../theme/index.js';
5
+ export interface ImageProps extends Omit<React.ImgHTMLAttributes<HTMLImageElement>, 'height' | 'width'> {
6
+ alt: string;
7
+ src: string;
8
+ aspectRatio?: CSS['aspectRatio'];
9
+ height?: Responsive<CSS['height']>;
10
+ /**
11
+ * Determines if the image should be loaded eagerly or lazily.
12
+ * @default 'lazy'
13
+ */
14
+ loading?: 'eager' | 'lazy';
15
+ objectFit?: 'contain' | 'cover';
16
+ objectPosition?: 'center' | 'top' | 'bottom' | 'left' | 'right' | (string & {});
17
+ radius?: Responsive<RadiusSize>;
18
+ ref?: React.Ref<HTMLImageElement>;
19
+ width?: Responsive<CSS['width']>;
20
+ }
21
+ export declare function Image({ loading, width, height, ...props }: ImageProps): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { jsx } from "@emotion/react/jsx-runtime";
2
+ import styled from "@emotion/styled";
3
+ import { getRadius, rc } from "../layout/index.js";
4
+ function Image({ loading, width, height, ...props }) {
5
+ return /*#__PURE__*/ jsx(Img, {
6
+ loading: loading ?? 'lazy',
7
+ w: width,
8
+ h: height,
9
+ ...props
10
+ });
11
+ }
12
+ const Img = styled('img')`
13
+ ${(p)=>rc('width', p.w ?? '100%', p.theme)};
14
+ ${(p)=>rc('height', p.h ?? 'auto', p.theme)};
15
+ object-fit: ${(p)=>p.objectFit};
16
+ object-position: ${(p)=>p.objectPosition};
17
+ aspect-ratio: ${(p)=>p.aspectRatio};
18
+ ${(p)=>rc('border-radius', p.radius, p.theme, getRadius)};
19
+ `;
20
+ export { Image };
@@ -0,0 +1 @@
1
+ export { Image, type ImageProps } from './image.js';
@@ -0,0 +1 @@
1
+ export { Image } from "./image.js";
@@ -0,0 +1,2 @@
1
+ export { InfoText, type InfoTextProps } from './infoText.js';
2
+ export { InfoTip, DisabledTip } from './infoTip.js';
@@ -0,0 +1,2 @@
1
+ export { InfoText } from "./infoText.js";
2
+ export { DisabledTip, InfoTip } from "./infoTip.js";
@@ -0,0 +1,15 @@
1
+ import type * as React from 'react';
2
+ import type { DistributedOmit } from 'type-fest';
3
+ import { type TextProps } from '../text/index.js';
4
+ import { type TooltipProps } from '../tooltip/index.js';
5
+ type InfoTextBaseProps<T extends 'span' | 'p' | 'label' | 'div' | 'time'> = DistributedOmit<TextProps<T>, 'title' | 'variant' | 'underline'> & {
6
+ title: React.ReactNode;
7
+ variant?: TooltipProps['underlineColor'] | 'inherit';
8
+ } & Pick<TooltipProps, 'position' | 'maxWidth' | 'delay'>;
9
+ export type InfoTextProps<T extends 'span' | 'p' | 'label' | 'div' | 'time'> = (InfoTextBaseProps<T> & {
10
+ mode?: undefined;
11
+ }) | (DistributedOmit<InfoTextBaseProps<T>, 'display' | 'wrap'> & {
12
+ mode: 'overflowOnly';
13
+ });
14
+ export declare function InfoText<T extends 'span' | 'p' | 'label' | 'div' | 'time' = 'span'>({ title, children, position, maxWidth, delay, mode, ...textProps }: InfoTextProps<T>): import("@emotion/react/jsx-runtime").JSX.Element;
15
+ export {};
@@ -0,0 +1,43 @@
1
+ import { jsx } from "@emotion/react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import styled from "@emotion/styled";
4
+ import { Text } from "../text/index.js";
5
+ import { Tooltip } from "../tooltip/index.js";
6
+ function InfoText({ title, children, position, maxWidth, delay, mode, ...textProps }) {
7
+ const isOverflowOnly = 'overflowOnly' === mode;
8
+ const [isOverflowing, setIsOverflowing] = useState(false);
9
+ const textPropsWithMode = {
10
+ ...textProps,
11
+ ...isOverflowOnly ? {
12
+ ellipsis: true
13
+ } : {}
14
+ };
15
+ if (!title) return /*#__PURE__*/ jsx(Text, {
16
+ ...textPropsWithMode,
17
+ children: children
18
+ });
19
+ return /*#__PURE__*/ jsx(Tooltip, {
20
+ title: title,
21
+ position: position,
22
+ maxWidth: maxWidth,
23
+ delay: delay,
24
+ showOnlyOnOverflow: isOverflowOnly,
25
+ onOverflowChange: isOverflowOnly ? setIsOverflowing : void 0,
26
+ skipWrapper: true,
27
+ showUnderline: !isOverflowOnly,
28
+ underlineColor: 'inherit' === textProps.variant ? void 0 : textProps.variant,
29
+ children: /*#__PURE__*/ jsx(StyledText, {
30
+ ...textPropsWithMode,
31
+ tabIndex: isOverflowOnly && !isOverflowing ? void 0 : 0,
32
+ children: children
33
+ })
34
+ });
35
+ }
36
+ const StyledText = styled(Text)`
37
+ outline: none;
38
+
39
+ &:focus-visible {
40
+ ${(p)=>p.theme.focusRing()}
41
+ }
42
+ `;
43
+ export { InfoText };
@@ -0,0 +1,10 @@
1
+ import type * as React from 'react';
2
+ import type { SVGIconProps } from '@sentry/icons/svgIcon';
3
+ import { type TooltipProps } from '../tooltip/index.js';
4
+ interface InfoTooltipProps extends SVGIconProps {
5
+ title: React.ReactNode;
6
+ position?: TooltipProps['position'];
7
+ }
8
+ export declare function InfoTip(props: InfoTooltipProps): import("@emotion/react/jsx-runtime").JSX.Element;
9
+ export declare function DisabledTip(props: InfoTooltipProps): import("@emotion/react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,54 @@
1
+ import { jsx } from "@emotion/react/jsx-runtime";
2
+ import styled from "@emotion/styled";
3
+ import { IconLock } from "@sentry/icons/lock";
4
+ import { IconQuestion } from "@sentry/icons/question";
5
+ import { Tooltip } from "../tooltip/index.js";
6
+ import { useTranslation } from "../translation/useTranslation.js";
7
+ function IconWithTooltip({ title, position, icon: Icon, 'aria-label': ariaLabel, ...props }) {
8
+ return /*#__PURE__*/ jsx(Tooltip, {
9
+ title: title,
10
+ skipWrapper: true,
11
+ position: position,
12
+ children: /*#__PURE__*/ jsx(StyledIconWrapper, {
13
+ tabIndex: 0,
14
+ role: "img",
15
+ "aria-label": ariaLabel,
16
+ children: /*#__PURE__*/ jsx(Icon, {
17
+ ...props,
18
+ "aria-hidden": true
19
+ })
20
+ })
21
+ });
22
+ }
23
+ const StyledIconWrapper = styled('span')`
24
+ display: inline-flex;
25
+ border-radius: 50%;
26
+ outline: none;
27
+
28
+ &:focus-visible {
29
+ ${(p)=>p.theme.focusRing()}
30
+ }
31
+ `;
32
+ function InfoTip(props) {
33
+ const { t } = useTranslation();
34
+ return /*#__PURE__*/ jsx(IconWithTooltip, {
35
+ ...props,
36
+ icon: IconQuestion,
37
+ "aria-label": t('More information')
38
+ });
39
+ }
40
+ function LockIcon(props) {
41
+ return /*#__PURE__*/ jsx(IconLock, {
42
+ locked: true,
43
+ ...props
44
+ });
45
+ }
46
+ function DisabledTip(props) {
47
+ const { t } = useTranslation();
48
+ return /*#__PURE__*/ jsx(IconWithTooltip, {
49
+ ...props,
50
+ icon: LockIcon,
51
+ "aria-label": t('Disabled')
52
+ });
53
+ }
54
+ export { DisabledTip, InfoTip };
@@ -0,0 +1,8 @@
1
+ export { Input, type InputProps, type InputStylesProps } from './input.js';
2
+ export { InputGroup } from './inputGroup.js';
3
+ /** @public */
4
+ export { NumberDragInput } from './numberDragInput.js';
5
+ export { NumberInput } from './numberInput.js';
6
+ /** @public */
7
+ export { OTPInput, type OTPInputProps } from './otpInput.js';
8
+ export { useAutosizeInput } from './useAutosizeInput.js';
@@ -0,0 +1,6 @@
1
+ export { Input } from "./input.js";
2
+ export { InputGroup } from "./inputGroup.js";
3
+ export { NumberDragInput } from "./numberDragInput.js";
4
+ export { NumberInput } from "./numberInput.js";
5
+ export { OTPInput } from "./otpInput.js";
6
+ export { useAutosizeInput } from "./useAutosizeInput.js";
@@ -0,0 +1,19 @@
1
+ import type * as React from 'react';
2
+ import { type InputStylesProps } from './inputStyles.js';
3
+ export { type InputStylesProps } from './inputStyles.js';
4
+ export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'readOnly'>, InputStylesProps {
5
+ ref?: React.Ref<HTMLInputElement>;
6
+ }
7
+ /**
8
+ * Basic input component.
9
+ *
10
+ * Use the `size` prop ('md', 'sm', 'xs') to control the input's height &
11
+ * padding. To use the native size attribute (which controls the number of
12
+ * characters the input should fit), use the `nativeSize` prop instead.
13
+ *
14
+ * To add leading/trailing items (e.g. a search icon on the left side), use
15
+ * InputControl (components/inputControl) instead.
16
+ */
17
+ export declare const Input: import("@emotion/styled").StyledComponent<InputProps & {
18
+ theme?: import("@emotion/react").Theme;
19
+ }, {}, {}>;
@@ -0,0 +1,14 @@
1
+ import { jsx } from "@emotion/react/jsx-runtime";
2
+ import is_prop_valid from "@emotion/is-prop-valid";
3
+ import styled from "@emotion/styled";
4
+ import { inputStyles } from "./inputStyles.js";
5
+ const Input = styled(({ ref, size: _size, nativeSize, ...props })=>/*#__PURE__*/ jsx("input", {
6
+ ...props,
7
+ ref: ref,
8
+ size: nativeSize
9
+ }), {
10
+ shouldForwardProp: (prop)=>'nativeSize' === prop || is_prop_valid(prop)
11
+ })`
12
+ ${(p)=>inputStyles(p)};
13
+ `;
14
+ export { Input };
@@ -0,0 +1,29 @@
1
+ import type * as React from 'react';
2
+ import type { InputProps } from './index.js';
3
+ import { type TextAreaProps } from '../textarea/index.js';
4
+ /**
5
+ * Wrapper for input group. To be used alongisde `Input`, `InputGroup.LeadingItems`,
6
+ * and `InputGroup.TrailingItems`:
7
+ * <InputGroup>
8
+ * <InputGroup.LeadingItems> … </InputGroup.LeadingItems>
9
+ * <Input />
10
+ * <InputGroup.TrailingItems> … </InputGroup.TrailingItems>
11
+ * </InputGroup>
12
+ */
13
+ export declare function InputGroup({ children, ...props }: React.HTMLAttributes<HTMLDivElement>): import("@emotion/react/jsx-runtime").JSX.Element;
14
+ export declare namespace InputGroup {
15
+ var Input: ({ ref, size, disabled, ...props }: InputProps) => import("@emotion/react/jsx-runtime").JSX.Element;
16
+ var TextArea: ({ ref, size, disabled, ...props }: TextAreaProps) => import("@emotion/react/jsx-runtime").JSX.Element;
17
+ var LeadingItems: ({ children, disablePointerEvents, ...props }: InputItemsProps) => import("@emotion/react/jsx-runtime").JSX.Element;
18
+ var TrailingItems: ({ children, disablePointerEvents, ...props }: InputItemsProps) => import("@emotion/react/jsx-runtime").JSX.Element;
19
+ }
20
+ interface InputItemsProps extends React.HTMLAttributes<HTMLDivElement> {
21
+ /**
22
+ * Whether to disable pointer events on the leading/trailing item wrap. This
23
+ * should be set to true when none of the items inside the wrap are
24
+ * interactive (e.g. a leading search icon). That way, mouse clicks will
25
+ * fall through to the `Input` underneath and trigger a focus event.
26
+ */
27
+ disablePointerEvents?: boolean;
28
+ }
29
+ export {};