@sentry/scraps 0.3.0 → 0.5.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 (321) hide show
  1. package/README.md +6 -5
  2. package/dist/alert/alert.js +0 -3
  3. package/dist/badge/badge.js +1 -2
  4. package/dist/badge/tag.js +0 -2
  5. package/dist/button/index.d.ts +0 -1
  6. package/dist/button/index.js +0 -1
  7. package/dist/clipboard/copyToClipboardButton.d.ts +15 -0
  8. package/dist/clipboard/copyToClipboardButton.js +32 -0
  9. package/dist/clipboard/index.d.ts +1 -0
  10. package/dist/clipboard/index.js +1 -0
  11. package/dist/code/index.d.ts +1 -0
  12. package/dist/code/index.js +1 -0
  13. package/dist/codeBlock/codeBlock.d.ts +68 -0
  14. package/dist/codeBlock/codeBlock.js +242 -0
  15. package/dist/codeBlock/index.d.ts +2 -0
  16. package/dist/codeBlock/index.js +2 -0
  17. package/dist/codeBlock/prism.d.ts +11 -0
  18. package/dist/codeBlock/prism.js +101 -0
  19. package/dist/codeBlock/styles.d.ts +2 -0
  20. package/dist/codeBlock/styles.js +133 -0
  21. package/dist/compactSelect/compactSelect.d.ts +21 -0
  22. package/dist/compactSelect/compactSelect.js +150 -0
  23. package/dist/compactSelect/composite.d.ts +54 -0
  24. package/dist/compactSelect/composite.js +101 -0
  25. package/dist/compactSelect/control.d.ts +112 -0
  26. package/dist/compactSelect/control.js +354 -0
  27. package/dist/compactSelect/fzf.d.ts +8 -0
  28. package/dist/compactSelect/fzf.js +151 -0
  29. package/dist/compactSelect/gridList/index.d.ts +46 -0
  30. package/dist/compactSelect/gridList/index.js +102 -0
  31. package/dist/compactSelect/gridList/option.d.ts +15 -0
  32. package/dist/compactSelect/gridList/option.js +111 -0
  33. package/dist/compactSelect/gridList/section.d.ts +15 -0
  34. package/dist/compactSelect/gridList/section.js +58 -0
  35. package/dist/compactSelect/highlightText.d.ts +6 -0
  36. package/dist/compactSelect/highlightText.js +33 -0
  37. package/dist/compactSelect/index.d.ts +9 -0
  38. package/dist/compactSelect/index.js +8 -0
  39. package/dist/compactSelect/list.d.ts +94 -0
  40. package/dist/compactSelect/list.js +167 -0
  41. package/dist/compactSelect/listBox/index.d.ts +84 -0
  42. package/dist/compactSelect/listBox/index.js +175 -0
  43. package/dist/compactSelect/listBox/option.d.ts +19 -0
  44. package/dist/compactSelect/listBox/option.js +101 -0
  45. package/dist/compactSelect/listBox/section.d.ts +21 -0
  46. package/dist/compactSelect/listBox/section.js +58 -0
  47. package/dist/compactSelect/menuComponents.d.ts +89 -0
  48. package/dist/compactSelect/menuComponents.js +117 -0
  49. package/dist/compactSelect/selectFilterContext.d.ts +2 -0
  50. package/dist/compactSelect/selectFilterContext.js +3 -0
  51. package/dist/compactSelect/styles.d.ts +39 -0
  52. package/dist/compactSelect/styles.js +155 -0
  53. package/dist/compactSelect/types.d.ts +1 -0
  54. package/dist/compactSelect/types.js +0 -0
  55. package/dist/compactSelect/useVirtualizedItems.d.ts +52 -0
  56. package/dist/compactSelect/useVirtualizedItems.js +74 -0
  57. package/dist/compactSelect/utils.d.ts +80 -0
  58. package/dist/compactSelect/utils.js +268 -0
  59. package/dist/confirm/index.d.ts +153 -0
  60. package/dist/confirm/index.js +132 -0
  61. package/dist/descriptionList/descriptionList.js +4 -3
  62. package/dist/disclosure/disclosure.js +2 -2
  63. package/dist/dragHandle/dragHandle.d.ts +3 -1
  64. package/dist/dragHandle/dragHandle.js +8 -5
  65. package/dist/drawer/components.d.ts +46 -0
  66. package/dist/drawer/components.js +265 -0
  67. package/dist/drawer/globalDrawer.d.ts +106 -0
  68. package/dist/drawer/globalDrawer.js +173 -0
  69. package/dist/drawer/index.d.ts +3 -0
  70. package/dist/drawer/index.js +2 -0
  71. package/dist/drawer/useDrawerResizing.d.ts +19 -0
  72. package/dist/drawer/useDrawerResizing.js +111 -0
  73. package/dist/drawer/useDrawerWidth.d.ts +1 -0
  74. package/dist/drawer/useDrawerWidth.js +42 -0
  75. package/dist/dropdownMenu/content.d.ts +1 -0
  76. package/dist/dropdownMenu/content.js +1 -0
  77. package/dist/dropdownMenu/context.d.ts +24 -0
  78. package/dist/dropdownMenu/context.js +3 -0
  79. package/dist/dropdownMenu/dropdownMenu.d.ts +70 -0
  80. package/dist/dropdownMenu/dropdownMenu.js +103 -0
  81. package/dist/dropdownMenu/index.d.ts +2 -0
  82. package/dist/dropdownMenu/index.js +1 -0
  83. package/dist/dropdownMenu/item.d.ts +136 -0
  84. package/dist/dropdownMenu/item.js +182 -0
  85. package/dist/dropdownMenu/list.d.ts +59 -0
  86. package/dist/dropdownMenu/list.js +410 -0
  87. package/dist/dropdownMenu/search.d.ts +16 -0
  88. package/dist/dropdownMenu/search.js +16 -0
  89. package/dist/dropdownMenu/section.d.ts +21 -0
  90. package/dist/dropdownMenu/section.js +40 -0
  91. package/dist/dropdownMenu/separator.d.ts +7 -0
  92. package/dist/dropdownMenu/separator.js +15 -0
  93. package/dist/dropdownMenu/useDropdownMenuKeyboard.d.ts +260 -0
  94. package/dist/dropdownMenu/useDropdownMenuKeyboard.js +55 -0
  95. package/dist/dropdownMenu/useDropdownMenuRowLayout.d.ts +29 -0
  96. package/dist/dropdownMenu/useDropdownMenuRowLayout.js +64 -0
  97. package/dist/dropdownMenu/useSafetyTriangle.d.ts +12 -0
  98. package/dist/dropdownMenu/useSafetyTriangle.js +119 -0
  99. package/dist/dropdownMenu/utils.d.ts +21 -0
  100. package/dist/dropdownMenu/utils.js +57 -0
  101. package/dist/form/FormSearch.d.ts +19 -0
  102. package/dist/form/FormSearch.js +4 -0
  103. package/dist/form/autoSaveForm.d.ts +110 -0
  104. package/dist/form/autoSaveForm.js +100 -0
  105. package/dist/{formPresentation → form}/displayField.js +2 -2
  106. package/dist/form/field/baseField.d.ts +23 -0
  107. package/dist/form/field/baseField.js +116 -0
  108. package/dist/form/field/checkboxField.d.ts +11 -0
  109. package/dist/form/field/checkboxField.js +42 -0
  110. package/dist/form/field/checkboxGroupField.d.ts +16 -0
  111. package/dist/form/field/checkboxGroupField.js +80 -0
  112. package/dist/form/field/compactSelectField.d.ts +19 -0
  113. package/dist/form/field/compactSelectField.js +77 -0
  114. package/dist/{formPresentation → form/field}/fieldIds.js +1 -1
  115. package/dist/form/field/inputField.d.ts +19 -0
  116. package/dist/form/field/inputField.js +31 -0
  117. package/dist/{formPresentation → form/field}/meta.js +6 -6
  118. package/dist/form/field/numberField.d.ts +5 -0
  119. package/dist/form/field/numberField.js +11 -0
  120. package/dist/form/field/passwordField.d.ts +3 -0
  121. package/dist/form/field/passwordField.js +27 -0
  122. package/dist/form/field/radioGroupField.d.ts +16 -0
  123. package/dist/form/field/radioGroupField.js +92 -0
  124. package/dist/form/field/rangeField.d.ts +8 -0
  125. package/dist/form/field/rangeField.js +34 -0
  126. package/dist/form/field/selectAsyncField.d.ts +31 -0
  127. package/dist/form/field/selectAsyncField.js +22 -0
  128. package/dist/form/field/selectField.d.ts +9 -0
  129. package/dist/form/field/selectField.js +72 -0
  130. package/dist/form/field/switchField.d.ts +7 -0
  131. package/dist/form/field/switchField.js +37 -0
  132. package/dist/form/field/textAreaField.d.ts +7 -0
  133. package/dist/form/field/textAreaField.js +25 -0
  134. package/dist/{formPresentation → form}/formContext.js +1 -1
  135. package/dist/form/formErrorContext/index.d.ts +9 -0
  136. package/dist/form/formErrorContext/index.js +7 -0
  137. package/dist/form/index.d.ts +9 -0
  138. package/dist/form/index.js +8 -0
  139. package/dist/{formPresentation → form/layout}/base.d.ts +1 -1
  140. package/dist/{formPresentation → form/layout}/base.js +1 -1
  141. package/dist/form/layout/fieldGroup.d.ts +6 -0
  142. package/dist/form/layout/fieldGroup.js +60 -0
  143. package/dist/{formPresentation/fieldLayout.d.ts → form/layout/index.d.ts} +1 -1
  144. package/dist/{formPresentation/fieldLayout.js → form/layout/index.js} +3 -3
  145. package/dist/{formPresentation → form/layout}/useStackedLayout.js +1 -1
  146. package/dist/form/scrapsForm.d.ts +220 -0
  147. package/dist/form/scrapsForm.js +126 -0
  148. package/dist/hotkey/hotkey.d.ts +9 -8
  149. package/dist/hotkey/hotkey.js +13 -6
  150. package/dist/hotkey/index.d.ts +2 -1
  151. package/dist/hotkey/index.js +2 -1
  152. package/dist/hotkey/keyMappings.d.ts +1 -15
  153. package/dist/hotkey/keyMappings.js +29 -174
  154. package/dist/hotkey/useHotkeys.d.ts +3 -47
  155. package/dist/hotkey/useHotkeys.js +8 -42
  156. package/dist/image/image.js +2 -1
  157. package/dist/info/infoTip.d.ts +1 -1
  158. package/dist/info/infoTip.js +4 -3
  159. package/dist/input/index.d.ts +0 -3
  160. package/dist/input/index.js +0 -2
  161. package/dist/input/input.d.ts +2 -0
  162. package/dist/input/input.js +2 -0
  163. package/dist/input/passwordManagerIgnoreProps.d.ts +11 -0
  164. package/dist/input/passwordManagerIgnoreProps.js +8 -0
  165. package/dist/layout/index.d.ts +2 -2
  166. package/dist/layout/index.js +1 -1
  167. package/dist/layout/styles.d.ts +1 -1
  168. package/dist/link/link.js +4 -3
  169. package/dist/link/linkBehaviorContext.d.ts +2 -0
  170. package/dist/link/linkBehaviorContext.js +17 -10
  171. package/dist/menu/controlContext.d.ts +32 -0
  172. package/dist/menu/controlContext.js +7 -0
  173. package/dist/menu/dropdownButton.d.ts +18 -0
  174. package/dist/menu/dropdownButton.js +66 -0
  175. package/dist/menu/index.d.ts +7 -0
  176. package/dist/menu/index.js +3 -0
  177. package/dist/menu/menu.d.ts +167 -0
  178. package/dist/menu/menu.js +568 -0
  179. package/dist/menu/selectTypes.d.ts +96 -0
  180. package/dist/menu/selectTypes.js +0 -0
  181. package/dist/menu/selectValue.d.ts +13 -0
  182. package/dist/menu/selectValue.js +0 -0
  183. package/dist/modal/components.d.ts +19 -0
  184. package/dist/modal/components.js +99 -0
  185. package/dist/modal/errorBoundary.d.ts +2 -0
  186. package/dist/modal/errorBoundary.js +35 -0
  187. package/dist/modal/index.d.ts +33 -0
  188. package/dist/modal/index.js +260 -0
  189. package/dist/modal/portal.d.ts +1 -0
  190. package/dist/modal/portal.js +10 -0
  191. package/dist/modal/state.d.ts +17 -0
  192. package/dist/modal/state.js +41 -0
  193. package/dist/modal/types.d.ts +75 -0
  194. package/dist/modal/types.js +0 -0
  195. package/dist/numberInput/index.d.ts +3 -0
  196. package/dist/numberInput/index.js +2 -0
  197. package/dist/{input → numberInput}/numberDragInput.d.ts +1 -1
  198. package/dist/{input → numberInput}/numberDragInput.js +1 -1
  199. package/dist/{input → numberInput}/numberInput.d.ts +1 -1
  200. package/dist/{input → numberInput}/numberInput.js +1 -1
  201. package/dist/overlayContext.d.ts +29 -0
  202. package/dist/overlayContext.js +7 -0
  203. package/dist/overlayTrigger.d.ts +22 -0
  204. package/dist/overlayTrigger.js +30 -0
  205. package/dist/pagination/index.d.ts +1 -0
  206. package/dist/pagination/index.js +1 -0
  207. package/dist/pagination/pagination.d.ts +24 -0
  208. package/dist/pagination/pagination.js +63 -0
  209. package/dist/pictureInPicture/index.d.ts +2 -0
  210. package/dist/pictureInPicture/index.js +2 -0
  211. package/dist/pictureInPicture/pictureInPicture.d.ts +47 -0
  212. package/dist/pictureInPicture/pictureInPicture.js +100 -0
  213. package/dist/pictureInPicture/pictureInPicturePortal.d.ts +16 -0
  214. package/dist/pictureInPicture/pictureInPicturePortal.js +46 -0
  215. package/dist/pictureInPicture/portalContext.d.ts +2 -0
  216. package/dist/pictureInPicture/portalContext.js +3 -0
  217. package/dist/revealOnHover/revealOnHover.js +1 -1
  218. package/dist/segmentedControl/segmentedControl.js +1 -1
  219. package/dist/select/filter.d.ts +4 -0
  220. package/dist/select/filter.js +12 -0
  221. package/dist/select/index.d.ts +3 -0
  222. package/dist/select/index.js +2 -0
  223. package/dist/select/option.d.ts +16 -0
  224. package/dist/select/option.js +81 -0
  225. package/dist/select/reactSelectWrapper.d.ts +8 -0
  226. package/dist/select/reactSelectWrapper.js +25 -0
  227. package/dist/select/select.d.ts +79 -0
  228. package/dist/select/select.js +454 -0
  229. package/dist/select/styles.d.ts +9 -0
  230. package/dist/select/styles.js +27 -0
  231. package/dist/select/types.d.ts +60 -0
  232. package/dist/select/types.js +0 -0
  233. package/dist/select/virtualizedMenuList.d.ts +24 -0
  234. package/dist/select/virtualizedMenuList.js +123 -0
  235. package/dist/slideOverPanel.d.ts +20 -0
  236. package/dist/slideOverPanel.js +141 -0
  237. package/dist/slot/knownContexts.d.ts +1 -1
  238. package/dist/spinner/index.d.ts +1 -0
  239. package/dist/spinner/index.js +1 -0
  240. package/dist/spinner/spinner.d.ts +14 -0
  241. package/dist/spinner/spinner.js +126 -0
  242. package/dist/splitPanel/index.d.ts +1 -0
  243. package/dist/splitPanel/index.js +1 -0
  244. package/dist/splitPanel/splitPanel.d.ts +38 -0
  245. package/dist/splitPanel/splitPanel.js +145 -0
  246. package/dist/table/table.d.ts +1 -1
  247. package/dist/table/table.js +39 -20
  248. package/dist/table/useColumnResize.d.ts +6 -5
  249. package/dist/table/useColumnResize.js +5 -4
  250. package/dist/tabs/index.d.ts +4 -0
  251. package/dist/tabs/index.js +3 -0
  252. package/dist/tabs/item.d.ts +13 -0
  253. package/dist/tabs/item.js +4 -0
  254. package/dist/tabs/tab.d.ts +22 -0
  255. package/dist/tabs/tab.js +205 -0
  256. package/dist/tabs/tabList.d.ts +18 -0
  257. package/dist/tabs/tabList.js +256 -0
  258. package/dist/tabs/tabPanels.d.ts +14 -0
  259. package/dist/tabs/tabPanels.js +62 -0
  260. package/dist/tabs/tabs.d.ts +38 -0
  261. package/dist/tabs/tabs.js +56 -0
  262. package/dist/tabs/utils.d.ts +3 -0
  263. package/dist/tabs/utils.js +6 -0
  264. package/dist/text/heading.d.ts +1 -1
  265. package/dist/text/heading.js +1 -1
  266. package/dist/text/styles.js +1 -1
  267. package/dist/text/text.d.ts +1 -1
  268. package/dist/text/text.js +1 -1
  269. package/dist/theme/dark.js +9 -9
  270. package/dist/theme/light.js +9 -9
  271. package/dist/toast/index.d.ts +5 -0
  272. package/dist/toast/index.js +4 -0
  273. package/dist/toast/toast.d.ts +10 -0
  274. package/dist/toast/toast.js +182 -0
  275. package/dist/toast/toastApi.d.ts +10 -0
  276. package/dist/toast/toastApi.js +53 -0
  277. package/dist/toast/toaster.d.ts +4 -0
  278. package/dist/toast/toaster.js +42 -0
  279. package/dist/toast/types.d.ts +17 -0
  280. package/dist/toast/types.js +2 -0
  281. package/dist/toggleCard/index.d.ts +1 -0
  282. package/dist/toggleCard/index.js +1 -0
  283. package/dist/toggleCard/toggleCard.d.ts +32 -0
  284. package/dist/toggleCard/toggleCard.js +301 -0
  285. package/dist/tooltip/tooltip.js +2 -5
  286. package/dist/useDimensions.d.ts +12 -0
  287. package/dist/useDimensions.js +31 -0
  288. package/dist/useMedia.d.ts +15 -0
  289. package/dist/useMedia.js +24 -0
  290. package/dist/useOnClickOutside.d.ts +2 -0
  291. package/dist/useOnClickOutside.js +22 -0
  292. package/dist/useOverlay.d.ts +1 -0
  293. package/dist/useOverlay.js +1 -0
  294. package/dist/useResizableDrawer.d.ts +72 -0
  295. package/dist/useResizableDrawer.js +136 -0
  296. package/dist/useVirtualCollection.d.ts +154 -0
  297. package/dist/useVirtualCollection.js +143 -0
  298. package/dist/useVirtualRows.d.ts +26 -0
  299. package/dist/useVirtualRows.js +26 -0
  300. package/dist/virtualCollectionLayout.d.ts +51 -0
  301. package/dist/virtualCollectionLayout.js +49 -0
  302. package/package.json +148 -16
  303. package/dist/formPresentation/index.d.ts +0 -8
  304. package/dist/formPresentation/index.js +0 -8
  305. package/dist/interactionStateLayer/index.d.ts +0 -1
  306. package/dist/interactionStateLayer/index.js +0 -1
  307. package/dist/interactionStateLayer/interactionStateLayer.d.ts +0 -23
  308. package/dist/interactionStateLayer/interactionStateLayer.js +0 -67
  309. package/dist/unreachable.d.ts +0 -1
  310. package/dist/unreachable.js +0 -4
  311. /package/dist/{formPresentation → form}/autoSaveContext.d.ts +0 -0
  312. /package/dist/{formPresentation → form}/autoSaveContext.js +0 -0
  313. /package/dist/{formPresentation → form}/displayField.d.ts +0 -0
  314. /package/dist/{formPresentation → form/field}/fieldIds.d.ts +0 -0
  315. /package/dist/{formPresentation → form/field}/groupContext.d.ts +0 -0
  316. /package/dist/{formPresentation → form/field}/groupContext.js +0 -0
  317. /package/dist/{formPresentation → form/field}/meta.d.ts +0 -0
  318. /package/dist/{formPresentation → form}/formContext.d.ts +0 -0
  319. /package/dist/{formPresentation → form}/icons.d.ts +0 -0
  320. /package/dist/{formPresentation → form}/icons.js +0 -0
  321. /package/dist/{formPresentation → form/layout}/useStackedLayout.d.ts +0 -0
@@ -0,0 +1,182 @@
1
+ import { jsx, jsxs } from "@emotion/react/jsx-runtime";
2
+ import styled from "@emotion/styled";
3
+ import { IconCheckmark } from "@sentry/icons/checkmark";
4
+ import { IconClose } from "@sentry/icons/close";
5
+ import { IconWarning } from "@sentry/icons/warning";
6
+ import { Button } from "../button/index.js";
7
+ import { Container, Flex } from "../layout/index.js";
8
+ import { Spinner } from "../spinner/index.js";
9
+ import { Text } from "../text/index.js";
10
+ import { useTranslation } from "../translation/useTranslation.js";
11
+ function Toast({ message, variant, action, onDismiss }) {
12
+ const { t } = useTranslation();
13
+ return /*#__PURE__*/ jsxs(ToastContainer, {
14
+ role: 'error' === variant ? 'alert' : 'status',
15
+ variant: variant,
16
+ children: [
17
+ /*#__PURE__*/ jsx(ToastIcon, {
18
+ variant: variant
19
+ }),
20
+ /*#__PURE__*/ jsx(Container, {
21
+ padding: "lg",
22
+ flex: "1",
23
+ minWidth: 0,
24
+ children: /*#__PURE__*/ jsx(Text, {
25
+ as: "div",
26
+ wrap: "normal",
27
+ wordBreak: "break-word",
28
+ children: message
29
+ })
30
+ }),
31
+ action ? /*#__PURE__*/ jsx(Flex, {
32
+ align: "center",
33
+ justify: "center",
34
+ padding: "0 lg",
35
+ children: /*#__PURE__*/ jsx(Button, {
36
+ variant: "secondary",
37
+ size: "xs",
38
+ onClick: (event)=>{
39
+ event.stopPropagation();
40
+ action.onClick();
41
+ onDismiss();
42
+ },
43
+ icon: action.icon,
44
+ children: action.label
45
+ })
46
+ }) : null,
47
+ /*#__PURE__*/ jsx(Flex, {
48
+ align: "center",
49
+ justify: "center",
50
+ padding: "0 lg",
51
+ children: /*#__PURE__*/ jsx(Button, {
52
+ "aria-label": t('Dismiss'),
53
+ variant: "transparent",
54
+ size: "xs",
55
+ icon: /*#__PURE__*/ jsx(IconClose, {
56
+ size: "xs"
57
+ }),
58
+ onClick: onDismiss
59
+ })
60
+ })
61
+ ]
62
+ });
63
+ }
64
+ function ToastIcon({ variant }) {
65
+ switch(variant){
66
+ case 'loading':
67
+ return /*#__PURE__*/ jsx(ToastIconContainer, {
68
+ variant: variant,
69
+ "aria-hidden": true,
70
+ children: /*#__PURE__*/ jsx(ToastSpinner, {
71
+ size: 16
72
+ })
73
+ });
74
+ case 'success':
75
+ return /*#__PURE__*/ jsx(ToastIconContainer, {
76
+ variant: variant,
77
+ "aria-hidden": true,
78
+ children: /*#__PURE__*/ jsx(IconCheckmark, {})
79
+ });
80
+ case 'error':
81
+ return /*#__PURE__*/ jsx(ToastIconContainer, {
82
+ variant: variant,
83
+ "aria-hidden": true,
84
+ children: /*#__PURE__*/ jsx(IconWarning, {})
85
+ });
86
+ case 'default':
87
+ return null;
88
+ default:
89
+ return variant;
90
+ }
91
+ }
92
+ function getContainerTheme(theme, variant) {
93
+ switch(variant){
94
+ case 'success':
95
+ return {
96
+ background: theme.tokens.background.transparent.success.muted,
97
+ borderBottom: `2px solid ${theme.tokens.border.success.moderate}`,
98
+ border: `1px solid ${theme.tokens.border.success.moderate}`,
99
+ boxShadow: theme.shadow.medium
100
+ };
101
+ case 'error':
102
+ return {
103
+ background: theme.tokens.background.transparent.danger.muted,
104
+ borderBottom: `2px solid ${theme.tokens.border.danger.moderate}`,
105
+ border: `1px solid ${theme.tokens.border.danger.moderate}`,
106
+ boxShadow: theme.shadow.medium
107
+ };
108
+ default:
109
+ return {
110
+ background: theme.tokens.background.overlay,
111
+ borderBottom: `2px solid ${theme.tokens.border.primary}`,
112
+ border: `1px solid ${theme.tokens.border.primary}`,
113
+ boxShadow: theme.shadow.medium
114
+ };
115
+ }
116
+ }
117
+ const ToastContainer = styled((props)=>{
118
+ const { variant, children, ...rest } = props;
119
+ return /*#__PURE__*/ jsx(ToastOuterContainer, {
120
+ variant: variant,
121
+ ...rest,
122
+ children: /*#__PURE__*/ jsx(ToastInnerContainer, {
123
+ variant: variant,
124
+ children: children
125
+ })
126
+ });
127
+ })``;
128
+ const ToastOuterContainer = styled('div')`
129
+ overflow: hidden;
130
+ /* The outer container is a separate element because the colors are not opaque,
131
+ * so we set the background color here to the background color so that the
132
+ * toast is not see-through.
133
+ */
134
+ background: ${(p)=>p.theme.tokens.background.primary};
135
+ border-radius: ${(p)=>p.theme.radius.lg};
136
+ border: ${(p)=>getContainerTheme(p.theme, p.variant).border};
137
+ box-shadow: ${(p)=>getContainerTheme(p.theme, p.variant).boxShadow};
138
+ `;
139
+ const ToastInnerContainer = styled('div')`
140
+ display: flex;
141
+ align-items: stretch;
142
+ background: ${(p)=>getContainerTheme(p.theme, p.variant).background};
143
+ `;
144
+ function getToastIconContainerTheme(theme, variant) {
145
+ switch(variant){
146
+ case 'success':
147
+ return {
148
+ background: theme.tokens.background.success.vibrant,
149
+ borderRight: `1px solid ${theme.tokens.border.success.moderate}`
150
+ };
151
+ case 'error':
152
+ return {
153
+ background: theme.tokens.background.danger.vibrant,
154
+ borderRight: `1px solid ${theme.tokens.border.danger.moderate}`
155
+ };
156
+ default:
157
+ return {
158
+ background: theme.tokens.background.overlay,
159
+ borderRight: `1px solid ${theme.tokens.border.primary}`
160
+ };
161
+ }
162
+ }
163
+ const ToastIconContainer = styled('div')`
164
+ display: flex;
165
+ align-items: center;
166
+ justify-content: center;
167
+ padding: ${(p)=>p.theme.space.lg} ${(p)=>p.theme.space.xl};
168
+ position: relative;
169
+ ${(p)=>({
170
+ ...getToastIconContainerTheme(p.theme, p.variant)
171
+ })};
172
+
173
+ svg {
174
+ width: 16px;
175
+ height: 16px;
176
+ color: ${(p)=>'success' === p.variant ? p.theme.tokens.content.onVibrant.dark : 'error' === p.variant ? p.theme.tokens.content.onVibrant.light : void 0} !important;
177
+ }
178
+ `;
179
+ const ToastSpinner = styled(Spinner)`
180
+ margin: 0;
181
+ `;
182
+ export { Toast };
@@ -0,0 +1,10 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { ToastOptions } from './types.js';
3
+ export declare const toast: {
4
+ success: (message: ReactNode, options?: ToastOptions) => string | number;
5
+ error: (message: ReactNode, options?: ToastOptions) => string | number;
6
+ loading: (message: ReactNode, options?: ToastOptions) => string | number;
7
+ message: (message: ReactNode, options?: ToastOptions) => string | number;
8
+ /** Dismisses every toast. */
9
+ dismiss: () => string | number;
10
+ };
@@ -0,0 +1,53 @@
1
+ import { jsx } from "@emotion/react/jsx-runtime";
2
+ import { toast } from "sonner";
3
+ import { Toast } from "./toast.js";
4
+ const activeToastIds = new Map();
5
+ function removeActiveToast(variant, toastId) {
6
+ const ids = activeToastIds.get(variant);
7
+ ids?.delete(toastId);
8
+ if (ids?.size === 0) activeToastIds.delete(variant);
9
+ }
10
+ function dismissOtherVariants(variant, toastIdToUpdate) {
11
+ for (const [activeVariant, ids] of activeToastIds)if (activeVariant !== variant) {
12
+ for (const toastId of ids)if (toastId !== toastIdToUpdate) toast.dismiss(toastId);
13
+ activeToastIds.delete(activeVariant);
14
+ }
15
+ }
16
+ function show(variant, message, options = {}) {
17
+ const { action, duration, id, onDismiss } = options;
18
+ dismissOtherVariants(variant, id);
19
+ const toastId = toast.custom((renderedToastId)=>/*#__PURE__*/ jsx(Toast, {
20
+ variant: variant,
21
+ message: message,
22
+ action: action,
23
+ onDismiss: ()=>toast.dismiss(renderedToastId)
24
+ }), {
25
+ duration,
26
+ onDismiss: (dismissedToast)=>{
27
+ removeActiveToast(variant, dismissedToast.id);
28
+ onDismiss?.();
29
+ },
30
+ onAutoClose: (dismissedToast)=>{
31
+ removeActiveToast(variant, dismissedToast.id);
32
+ onDismiss?.();
33
+ },
34
+ ...void 0 === id ? {} : {
35
+ id
36
+ }
37
+ });
38
+ const ids = activeToastIds.get(variant) ?? new Set();
39
+ ids.add(toastId);
40
+ activeToastIds.set(variant, ids);
41
+ return toastId;
42
+ }
43
+ const toastApi_toast = {
44
+ success: (message, options)=>show('success', message, options),
45
+ error: (message, options)=>show('error', message, options),
46
+ loading: (message, options)=>show('loading', message, options),
47
+ message: (message, options)=>show('default', message, options),
48
+ dismiss: ()=>{
49
+ activeToastIds.clear();
50
+ return toast.dismiss();
51
+ }
52
+ };
53
+ export { toastApi_toast as toast };
@@ -0,0 +1,4 @@
1
+ import type { ReactNode } from 'react';
2
+ export declare function ToastProvider({ children }: {
3
+ children?: ReactNode;
4
+ }): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,42 @@
1
+ import { jsx, jsxs } from "@emotion/react/jsx-runtime";
2
+ import { Fragment } from "react";
3
+ import styled from "@emotion/styled";
4
+ import { Toaster } from "sonner";
5
+ import { useTranslation } from "../translation/useTranslation.js";
6
+ import { DEFAULT_TOAST_DURATION } from "./types.js";
7
+ const StyledToaster = styled(Toaster)`
8
+ &[data-sonner-toaster] {
9
+ z-index: ${(p)=>p.theme.zIndex.toast};
10
+ width: auto;
11
+ }
12
+
13
+ &[data-sonner-toaster] [data-sonner-toast] {
14
+ width: min(400px, calc(100vw - 60px));
15
+ }
16
+
17
+ /* Sonner hides overflow toasts with opacity and pointer-events, which leaves
18
+ * them in the accessibility tree and tab order. */
19
+ &[data-sonner-toaster] [data-sonner-toast][data-visible='false'] {
20
+ visibility: hidden;
21
+ }
22
+ `;
23
+ function ToastProvider({ children }) {
24
+ const { t } = useTranslation();
25
+ return /*#__PURE__*/ jsxs(Fragment, {
26
+ children: [
27
+ children,
28
+ /*#__PURE__*/ jsx(StyledToaster, {
29
+ position: "bottom-right",
30
+ offset: {
31
+ bottom: '30px',
32
+ right: 'calc(30px + var(--scrollbar-size, 0px))'
33
+ },
34
+ duration: DEFAULT_TOAST_DURATION,
35
+ gap: 12,
36
+ visibleToasts: 3,
37
+ containerAriaLabel: t('Notifications')
38
+ })
39
+ ]
40
+ });
41
+ }
42
+ export { ToastProvider };
@@ -0,0 +1,17 @@
1
+ import type { ReactNode } from 'react';
2
+ export declare const DEFAULT_TOAST_DURATION = 6000;
3
+ export type ToastVariant = 'success' | 'error' | 'loading' | 'default';
4
+ export interface ToastAction {
5
+ label: ReactNode;
6
+ onClick: () => void;
7
+ icon?: ReactNode;
8
+ }
9
+ export interface ToastOptions {
10
+ /** Renders a button next to the message. The toast dismisses after onClick. */
11
+ action?: ToastAction;
12
+ /** ms. Use `Infinity` to keep the toast until it is dismissed. */
13
+ duration?: number;
14
+ /** Pass an existing id to replace that toast instead of adding one. */
15
+ id?: string | number;
16
+ onDismiss?: () => void;
17
+ }
@@ -0,0 +1,2 @@
1
+ const DEFAULT_TOAST_DURATION = 6000;
2
+ export { DEFAULT_TOAST_DURATION };
@@ -0,0 +1 @@
1
+ export { ToggleCard, type ToggleCardProps } from './toggleCard.js';
@@ -0,0 +1 @@
1
+ export { ToggleCard } from "./toggleCard.js";
@@ -0,0 +1,32 @@
1
+ import type * as React from 'react';
2
+ import { type ContainerProps } from '../layout/index.js';
3
+ interface CommonProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onChange'> {
4
+ autoFocus?: boolean;
5
+ disabled?: boolean;
6
+ padding?: ContainerProps['padding'];
7
+ ref?: React.Ref<HTMLElement>;
8
+ }
9
+ interface SelectionProps extends Omit<CommonProps, 'onClick'> {
10
+ checked: boolean;
11
+ onChange: React.ChangeEventHandler<HTMLInputElement>;
12
+ variant: 'radio' | 'checkbox';
13
+ details?: React.ReactNode;
14
+ name?: string;
15
+ onClick?: never;
16
+ required?: boolean;
17
+ value?: React.InputHTMLAttributes<HTMLInputElement>['value'];
18
+ }
19
+ interface ActionProps extends CommonProps, Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, keyof CommonProps | 'type'> {
20
+ variant: 'button';
21
+ checked?: never;
22
+ details?: never;
23
+ onChange?: never;
24
+ required?: never;
25
+ }
26
+ export type ToggleCardProps = SelectionProps | ActionProps;
27
+ declare function ToggleCardRoot(props: ToggleCardProps): import("@emotion/react/jsx-runtime").JSX.Element;
28
+ declare function ToggleCardIndicator(): import("@emotion/react/jsx-runtime").JSX.Element;
29
+ export declare const ToggleCard: typeof ToggleCardRoot & {
30
+ Indicator: typeof ToggleCardIndicator;
31
+ };
32
+ export {};
@@ -0,0 +1,301 @@
1
+ import { jsx, jsxs } from "@emotion/react/jsx-runtime";
2
+ import { useCallback, useId } from "react";
3
+ import { css } from "@emotion/react";
4
+ import styled from "@emotion/styled";
5
+ import { IconCheckmark } from "@sentry/icons/checkmark";
6
+ import { AnimatePresence, motion, useReducedMotion } from "framer-motion";
7
+ import { Container, Flex, Stack } from "../layout/index.js";
8
+ function ToggleCardRoot(props) {
9
+ const { ref, children, className, style, disabled, autoFocus, padding = 'xl' } = props;
10
+ const detailsId = useId();
11
+ const reducedMotion = useReducedMotion();
12
+ const setRef = useCallback((element)=>{
13
+ if ('function' == typeof ref) return ref(element);
14
+ if (ref) ref.current = element;
15
+ }, [
16
+ ref
17
+ ]);
18
+ if ('button' === props.variant) {
19
+ const { variant, onClick, checked: _checked, details: _details, ref: _ref, padding: _padding, className: _className, style: _style, ...buttonProps } = props;
20
+ return /*#__PURE__*/ jsx(Surface, {
21
+ ref: setRef,
22
+ className: className,
23
+ style: style,
24
+ "data-variant": variant,
25
+ "aria-disabled": disabled || void 0,
26
+ children: /*#__PURE__*/ jsx(Stack, {
27
+ height: "100%",
28
+ "data-toggle-card-face": true,
29
+ children: /*#__PURE__*/ jsx(ButtonTrigger, {
30
+ ...buttonProps,
31
+ type: "button",
32
+ disabled: void 0,
33
+ "aria-disabled": disabled || void 0,
34
+ autoFocus: autoFocus,
35
+ "data-toggle-card-trigger": true,
36
+ onClick: (event)=>{
37
+ if (disabled) event.preventDefault();
38
+ else onClick?.(event);
39
+ },
40
+ children: /*#__PURE__*/ jsx(Container, {
41
+ height: "100%",
42
+ padding: padding,
43
+ children: children
44
+ })
45
+ })
46
+ })
47
+ });
48
+ }
49
+ const { variant, checked, onChange, details, name, value, required, id, tabIndex, disabled: _disabled, autoFocus: _autoFocus, ref: _ref, children: _children, padding: _padding, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, "aria-description": ariaDescription, 'aria-invalid': ariaInvalid, 'aria-errormessage': ariaErrorMessage, ...surfaceProps } = props;
50
+ return /*#__PURE__*/ jsx(Surface, {
51
+ ...surfaceProps,
52
+ ref: setRef,
53
+ className: className,
54
+ style: style,
55
+ "aria-disabled": disabled || void 0,
56
+ "data-checked": checked,
57
+ "data-variant": variant,
58
+ children: /*#__PURE__*/ jsxs(Stack, {
59
+ height: "100%",
60
+ "data-toggle-card-face": true,
61
+ children: [
62
+ /*#__PURE__*/ jsxs(LabelTrigger, {
63
+ children: [
64
+ /*#__PURE__*/ jsx(SelectionInput, {
65
+ id: id,
66
+ tabIndex: tabIndex,
67
+ type: variant,
68
+ name: disabled ? void 0 : name,
69
+ value: value,
70
+ checked: checked,
71
+ required: disabled ? void 0 : required,
72
+ autoFocus: autoFocus,
73
+ "aria-label": ariaLabel,
74
+ "aria-labelledby": ariaLabelledBy,
75
+ "aria-describedby": ariaDescribedBy,
76
+ "aria-description": ariaDescription,
77
+ "aria-invalid": ariaInvalid,
78
+ "aria-errormessage": ariaErrorMessage,
79
+ "aria-disabled": disabled || void 0,
80
+ "aria-controls": checked && details ? detailsId : void 0,
81
+ "data-toggle-card-input": true,
82
+ onClickCapture: (event)=>{
83
+ if (disabled) {
84
+ event.preventDefault();
85
+ event.stopPropagation();
86
+ }
87
+ },
88
+ onChange: (event)=>{
89
+ if (!disabled) onChange(event);
90
+ }
91
+ }),
92
+ /*#__PURE__*/ jsx(Container, {
93
+ height: "100%",
94
+ padding: padding,
95
+ children: children
96
+ })
97
+ ]
98
+ }),
99
+ /*#__PURE__*/ jsx(AnimatePresence, {
100
+ initial: false,
101
+ children: checked && details && /*#__PURE__*/ jsx(motion.div, {
102
+ id: detailsId,
103
+ initial: {
104
+ height: 0,
105
+ opacity: 0,
106
+ overflow: 'hidden'
107
+ },
108
+ animate: {
109
+ height: 'auto',
110
+ opacity: 1,
111
+ overflow: 'hidden',
112
+ transitionEnd: {
113
+ overflow: 'visible'
114
+ }
115
+ },
116
+ exit: {
117
+ height: 0,
118
+ opacity: 0,
119
+ overflow: 'hidden'
120
+ },
121
+ transition: {
122
+ duration: reducedMotion ? 0 : 0.2,
123
+ ease: 'easeOut'
124
+ },
125
+ children: /*#__PURE__*/ jsx(Container, {
126
+ padding: padding,
127
+ paddingTop: "0",
128
+ children: details
129
+ })
130
+ }, "details")
131
+ })
132
+ ]
133
+ })
134
+ });
135
+ }
136
+ function ToggleCardIndicator() {
137
+ return /*#__PURE__*/ jsx(Indicator, {
138
+ as: "span",
139
+ align: "center",
140
+ justify: "center",
141
+ width: "20px",
142
+ height: "20px",
143
+ flexShrink: 0,
144
+ "aria-hidden": true,
145
+ pointerEvents: "none",
146
+ children: /*#__PURE__*/ jsx(IconCheckmark, {
147
+ size: "xs"
148
+ })
149
+ });
150
+ }
151
+ const ToggleCard = Object.assign(ToggleCardRoot, {
152
+ Indicator: ToggleCardIndicator
153
+ });
154
+ const Surface = styled('div')`
155
+ --card-lift: 2px;
156
+ --card-chonk: ${(p)=>p.theme.tokens.interactive.chonky.embossed.neutral.chonk};
157
+ --card-indicator-radius: ${(p)=>p.theme.radius.full};
158
+ --card-indicator-background: ${(p)=>p.theme.tokens.background.primary};
159
+ --card-indicator-border: ${(p)=>p.theme.tokens.border.primary};
160
+ --card-radio-dot: 0;
161
+ --card-checkbox-mark: 0;
162
+ position: relative;
163
+ width: 100%;
164
+ height: 100%;
165
+ border-radius: ${(p)=>p.theme.radius.md};
166
+ color: ${(p)=>p.theme.tokens.content.primary};
167
+ cursor: pointer;
168
+
169
+ &::before,
170
+ &::after {
171
+ content: '';
172
+ position: absolute;
173
+ inset: 0;
174
+ border-radius: inherit;
175
+ }
176
+ &::before {
177
+ background: var(--card-chonk);
178
+ }
179
+ &::after {
180
+ background: ${(p)=>p.theme.tokens.interactive.chonky.embossed.neutral.background};
181
+ border: 1px solid ${(p)=>p.theme.tokens.border.primary};
182
+ }
183
+ &::after,
184
+ > [data-toggle-card-face] {
185
+ transform: translateY(calc(-1 * var(--card-lift)));
186
+ transition: transform ${(p)=>p.theme.motion.snap.fast};
187
+ }
188
+ > [data-toggle-card-face] {
189
+ position: relative;
190
+ z-index: 1;
191
+ border-radius: inherit;
192
+ }
193
+ &[data-variant='checkbox'] {
194
+ --card-indicator-radius: ${(p)=>p.theme.radius.xs};
195
+ }
196
+ &:hover:not([aria-disabled='true']):not([data-checked='true']) {
197
+ --card-lift: 3px;
198
+ }
199
+ &:active,
200
+ &[data-checked='true'],
201
+ &[aria-disabled='true'] {
202
+ --card-lift: 0px;
203
+ }
204
+ &[data-checked='true'] {
205
+ --card-chonk: ${(p)=>p.theme.tokens.interactive.chonky.embossed.accent.chonk};
206
+ --card-indicator-background: ${(p)=>p.theme.tokens.interactive.chonky.debossed.accent.background};
207
+ --card-indicator-border: ${(p)=>p.theme.tokens.interactive.chonky.debossed.accent.chonk};
208
+ &::after {
209
+ border-color: ${(p)=>p.theme.tokens.border.accent.vibrant};
210
+ background-image: linear-gradient(
211
+ ${(p)=>p.theme.tokens.interactive.transparent.accent.selected.background.rest},
212
+ ${(p)=>p.theme.tokens.interactive.transparent.accent.selected.background.rest}
213
+ );
214
+ }
215
+ }
216
+ &[data-checked='true'][data-variant='radio'] {
217
+ --card-radio-dot: 1;
218
+ }
219
+ &[data-checked='true'][data-variant='checkbox'] {
220
+ --card-checkbox-mark: 1;
221
+ }
222
+ &[data-checked='true'][data-variant='checkbox']:hover:not(
223
+ [aria-disabled='true']
224
+ )::after {
225
+ background-image: linear-gradient(
226
+ ${(p)=>p.theme.tokens.interactive.transparent.accent.selected.background.hover},
227
+ ${(p)=>p.theme.tokens.interactive.transparent.accent.selected.background.hover}
228
+ );
229
+ }
230
+ &:has([data-toggle-card-input]:focus-visible),
231
+ &:has([data-toggle-card-trigger]:focus-visible) {
232
+ &::after {
233
+ box-shadow:
234
+ 0 var(--card-lift) 0 0 var(--card-chonk),
235
+ 0 var(--card-lift) 0 2px ${(p)=>p.theme.tokens.focus.default},
236
+ 0 0 0 2px ${(p)=>p.theme.tokens.focus.default};
237
+ }
238
+ }
239
+ &[aria-disabled='true'] {
240
+ cursor: not-allowed;
241
+ }
242
+ &[aria-disabled='true']:not([data-checked='true']) {
243
+ opacity: ${(p)=>p.theme.tokens.interactive.disabled};
244
+ }
245
+ @media (prefers-reduced-motion: reduce) {
246
+ &::after,
247
+ > [data-toggle-card-face] {
248
+ transition: none;
249
+ }
250
+ }
251
+ `;
252
+ const triggerStyles = ({ theme })=>css`
253
+ appearance: none;
254
+ display: block;
255
+ flex: 1;
256
+ width: 100%;
257
+ margin: 0;
258
+ padding: 0;
259
+ border: 0;
260
+ background: transparent;
261
+ color: inherit;
262
+ font: inherit;
263
+ font-weight: ${theme.font.weight.sans.regular};
264
+ text-align: left;
265
+ cursor: inherit;
266
+ outline: none;
267
+ `;
268
+ const LabelTrigger = styled('label')`
269
+ ${triggerStyles}
270
+ position: relative;
271
+ `;
272
+ const ButtonTrigger = styled('button')(triggerStyles);
273
+ const SelectionInput = styled('input')`
274
+ position: absolute;
275
+ inset: 0;
276
+ width: 100%;
277
+ height: 100%;
278
+ margin: 0;
279
+ opacity: 0;
280
+ cursor: inherit;
281
+ `;
282
+ const Indicator = styled(Flex)`
283
+ position: relative;
284
+ border: 1px solid var(--card-indicator-border);
285
+ background: var(--card-indicator-background);
286
+ border-radius: var(--card-indicator-radius);
287
+ color: ${(p)=>p.theme.tokens.content.onVibrant.light};
288
+ > svg {
289
+ opacity: var(--card-checkbox-mark);
290
+ }
291
+ &::after {
292
+ content: '';
293
+ position: absolute;
294
+ width: 10px;
295
+ height: 10px;
296
+ border-radius: ${(p)=>p.theme.radius.full};
297
+ background: currentColor;
298
+ opacity: var(--card-radio-dot);
299
+ }
300
+ `;
301
+ export { ToggleCard };
@@ -108,7 +108,7 @@ function TooltipHeader({ children, leadingItems, trailingItems }) {
108
108
  })
109
109
  ]
110
110
  }),
111
- defined(trailingItems) && /*#__PURE__*/ jsx(Text, {
111
+ null != trailingItems && /*#__PURE__*/ jsx(Text, {
112
112
  bold: true,
113
113
  align: "right",
114
114
  wrap: "nowrap",
@@ -160,7 +160,7 @@ function TooltipFooter({ children, leadingItems, trailingItems }) {
160
160
  })
161
161
  ]
162
162
  }),
163
- defined(trailingItems) && /*#__PURE__*/ jsx(Text, {
163
+ null != trailingItems && /*#__PURE__*/ jsx(Text, {
164
164
  variant: "muted",
165
165
  align: "right",
166
166
  wrap: "nowrap",
@@ -175,7 +175,4 @@ const Tooltip = Object.assign(TooltipComponent, {
175
175
  Row: TooltipRow,
176
176
  Footer: TooltipFooter
177
177
  });
178
- function defined(value) {
179
- return null != value;
180
- }
181
178
  export { Tooltip, TooltipContent, TooltipContext };