@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,568 @@
1
+ import { jsx, jsxs } from "@emotion/react/jsx-runtime";
2
+ import { createContext, useContext, useId, useState } from "react";
3
+ import { createPortal } from "react-dom";
4
+ import is_prop_valid from "@emotion/is-prop-valid";
5
+ import { css, useTheme } from "@emotion/react";
6
+ import styled from "@emotion/styled";
7
+ import { autoUpdate, hide, offset, useFloating } from "@floating-ui/react-dom";
8
+ import { FocusScope, getFocusableTreeWalker } from "@react-aria/focus";
9
+ import { mergeProps, mergeRefs } from "@react-aria/utils";
10
+ import { VisuallyHidden } from "@react-aria/visually-hidden";
11
+ import { IconSearch } from "@sentry/icons/search";
12
+ import { Button } from "../button/index.js";
13
+ import { InputGroup } from "../input/index.js";
14
+ import { Container, Flex, Stack } from "../layout/index.js";
15
+ import { Overlay, PositionWrapper } from "../overlay.js";
16
+ import { flipOverlay, shiftOverlay } from "../overlayPositioning.js";
17
+ import { Separator } from "../separator/index.js";
18
+ import { Text } from "../text/index.js";
19
+ import { Tooltip } from "../tooltip/index.js";
20
+ import { useTranslation } from "../translation/useTranslation.js";
21
+ function calculateMenuMinHeight(first, second) {
22
+ if (void 0 === first) return 'number' == typeof second ? `${second}px` : second;
23
+ if (void 0 === second) return 'number' == typeof first ? `${first}px` : first;
24
+ const firstHeight = 'number' == typeof first ? `${first}px` : first;
25
+ const secondHeight = 'number' == typeof second ? `${second}px` : second;
26
+ return `min(${firstHeight}, ${secondHeight})`;
27
+ }
28
+ function MenuHeaderLayout(props) {
29
+ return /*#__PURE__*/ jsx(Stack, {
30
+ borderBottom: "muted",
31
+ gap: "0",
32
+ ...props
33
+ });
34
+ }
35
+ function MenuHeading({ children, padding }) {
36
+ const heading = /*#__PURE__*/ jsx(Text, {
37
+ size: "sm",
38
+ density: "fixed",
39
+ bold: true,
40
+ tabular: true,
41
+ children: children
42
+ });
43
+ return padding ? /*#__PURE__*/ jsx(Container, {
44
+ padding: padding,
45
+ children: heading
46
+ }) : heading;
47
+ }
48
+ function MenuSectionLabel({ children, padding, size = 'sm', ...props }) {
49
+ return /*#__PURE__*/ jsx(Container, {
50
+ padding: padding,
51
+ children: /*#__PURE__*/ jsx(Text, {
52
+ as: "span",
53
+ size: size,
54
+ density: "fixed",
55
+ bold: true,
56
+ tabular: true,
57
+ ...props,
58
+ children: children
59
+ })
60
+ });
61
+ }
62
+ function MenuSectionHeader({ children, trailingAction, ...props }) {
63
+ return /*#__PURE__*/ jsxs(Flex, {
64
+ "data-section-header": true,
65
+ justify: "between",
66
+ align: "center",
67
+ minHeight: "1.5em",
68
+ padding: "2xs lg",
69
+ ...props,
70
+ children: [
71
+ children,
72
+ trailingAction
73
+ ]
74
+ });
75
+ }
76
+ function MenuSectionSeparator() {
77
+ return /*#__PURE__*/ jsx(Separator, {
78
+ orientation: "horizontal",
79
+ border: "muted"
80
+ });
81
+ }
82
+ function MenuSectionGroup(props) {
83
+ return /*#__PURE__*/ jsx(Container, {
84
+ as: "li",
85
+ display: "block",
86
+ ...props
87
+ });
88
+ }
89
+ function MenuSectionList(props) {
90
+ return /*#__PURE__*/ jsx(Stack, {
91
+ as: "ul",
92
+ role: "presentation",
93
+ margin: "0",
94
+ padding: "0",
95
+ ...props
96
+ });
97
+ }
98
+ function MenuFooterLayout(props) {
99
+ return /*#__PURE__*/ jsx(Flex, {
100
+ borderTop: "muted",
101
+ align: "center",
102
+ padding: "md lg",
103
+ ...props
104
+ });
105
+ }
106
+ function SearchInput({ padding = 'xs', ...props }) {
107
+ return /*#__PURE__*/ jsx(Container, {
108
+ padding: padding,
109
+ children: /*#__PURE__*/ jsxs(InputGroup, {
110
+ children: [
111
+ /*#__PURE__*/ jsx(InputGroup.LeadingItems, {
112
+ disablePointerEvents: true,
113
+ children: /*#__PURE__*/ jsx(Flex, {
114
+ paddingLeft: "2xs",
115
+ align: "center",
116
+ justify: "center",
117
+ children: /*#__PURE__*/ jsx(IconSearch, {
118
+ size: "xs",
119
+ variant: "muted"
120
+ })
121
+ })
122
+ }),
123
+ /*#__PURE__*/ jsx(InputGroup.Input, {
124
+ size: "xs",
125
+ type: "search",
126
+ ...props
127
+ })
128
+ ]
129
+ })
130
+ });
131
+ }
132
+ const ReserveLeadingSlotContext = /*#__PURE__*/ createContext(false);
133
+ function ReserveLeadingSlot({ reserve, children }) {
134
+ return /*#__PURE__*/ jsx(ReserveLeadingSlotContext, {
135
+ value: reserve,
136
+ children: children
137
+ });
138
+ }
139
+ function useReserveLeadingSlot() {
140
+ return useContext(ReserveLeadingSlotContext);
141
+ }
142
+ const TRAILING_ACTION_INSET = 'lg';
143
+ const TRAILING_ACTION_SPACE = '3xl';
144
+ const SECTION_ITEM_SPACE = '2xs';
145
+ const ITEM_PADDING_BY_SIZE = {
146
+ xs: 'xs md xs lg',
147
+ sm: 'sm md sm lg',
148
+ md: 'xs sm xs md'
149
+ };
150
+ const LABEL_TEXT_SIZE_BY_SIZE = {
151
+ xs: 'sm',
152
+ sm: 'md',
153
+ md: 'md'
154
+ };
155
+ function getTextColor({ theme, priority, disabled }) {
156
+ if (disabled) return theme.tokens.content.secondary;
157
+ switch(priority){
158
+ case 'primary':
159
+ return theme.tokens.content.accent;
160
+ case 'danger':
161
+ return theme.tokens.content.danger;
162
+ case 'default':
163
+ default:
164
+ return theme.tokens.content.primary;
165
+ }
166
+ }
167
+ const StyledInnerWrap = styled(Flex, {
168
+ shouldForwardProp: (prop)=>'string' == typeof prop && (is_prop_valid(prop) || [
169
+ 'padding',
170
+ 'paddingLeft',
171
+ 'paddingRight',
172
+ 'align',
173
+ 'alignSelf'
174
+ ].includes(prop)) && ![
175
+ 'disabled',
176
+ 'hasTrailingAction',
177
+ 'priority'
178
+ ].includes(prop)
179
+ })`
180
+ gap: ${(p)=>p.theme.space.xs};
181
+ position: relative;
182
+ border-radius: ${(p)=>p.theme.radius.md};
183
+ box-sizing: border-box;
184
+ background: ${(p)=>p.theme.tokens.interactive.transparent.neutral.background.rest};
185
+
186
+ font-size: ${(p)=>p.theme.form[p.size ?? 'md'].fontSize};
187
+
188
+ &,
189
+ &:hover,
190
+ &:focus,
191
+ &:focus-visible {
192
+ color: ${getTextColor};
193
+ box-shadow: none;
194
+ outline: none;
195
+ }
196
+ ${(p)=>p.disabled && 'cursor: default;'}
197
+
198
+ ${(p)=>!p.disabled && css`
199
+ &[data-focused='true'] {
200
+ ${!p.hasTrailingAction && 'z-index: 1;'}
201
+ background:
202
+ linear-gradient(
203
+ ${p.theme.tokens.interactive.transparent.neutral.background.hover},
204
+ ${p.theme.tokens.interactive.transparent.neutral.background.hover}
205
+ ),
206
+ ${p.theme.tokens.background.overlay};
207
+ }
208
+
209
+ &[data-pressed='true'],
210
+ &:active:not([data-pressed='false']),
211
+ &[aria-expanded='true']:not([data-pressed='false']),
212
+ &[aria-selected='true']:not([data-pressed='false']) {
213
+ ${!p.hasTrailingAction && 'z-index: 1;'}
214
+ background:
215
+ linear-gradient(
216
+ ${p.theme.tokens.interactive.transparent.neutral.background.active},
217
+ ${p.theme.tokens.interactive.transparent.neutral.background.active}
218
+ ),
219
+ ${p.theme.tokens.background.overlay};
220
+ }
221
+ `}
222
+ `;
223
+ const StyledContentWrap = styled('div')`
224
+ position: relative;
225
+ width: 100%;
226
+ min-width: 0;
227
+ display: flex;
228
+ gap: ${(p)=>p.theme.space.md};
229
+ justify-content: space-between;
230
+ align-items: center;
231
+ padding: 0;
232
+ `;
233
+ const StyledLeadingItems = styled('div')`
234
+ display: flex;
235
+ gap: ${(p)=>p.theme.space.md};
236
+ min-width: ${(p)=>p.theme.space['2xl']};
237
+ justify-content: center;
238
+ flex-shrink: 0;
239
+ /* Match the label's first line when details appear below it. */
240
+ min-height: ${(p)=>p.hasDetails ? p.theme.font.lineHeight.fixed : '24px'};
241
+ align-self: ${(p)=>p.hasDetails ? 'flex-start' : 'center'};
242
+ align-items: center;
243
+ margin-top: ${(p)=>p.hasDetails ? p.theme.space.xs : '0'};
244
+
245
+ ${(p)=>p.disabled && 'opacity: 0.5;'}
246
+ `;
247
+ const StyledDetails = styled('div')`
248
+ font-size: ${(p)=>p.theme.font.size.sm};
249
+ color: ${(p)=>p.theme.tokens.content.secondary};
250
+ line-height: 1.4;
251
+ margin-bottom: 0;
252
+
253
+ ${(p)=>'default' !== p.priority && css`
254
+ color: ${getTextColor(p)};
255
+ `}
256
+ `;
257
+ function MenuListItem({ label, details, as, priority = 'default', size, disabled = false, leadingItems = false, trailingItems = false, trailingAction, isFocused = false, isSelected = false, isPressed, innerWrapProps = {}, labelProps = {}, detailsProps = {}, showDetailsInOverlay = false, onDetailsHoverChange, tooltip, tooltipOptions, ref, trailingActionRef, trailingActionWrapperProps, ...props }) {
258
+ const [itemElement, setItemElement] = useState(null);
259
+ const [returnFocusTarget, setReturnFocusTarget] = useState(null);
260
+ const theme = useTheme();
261
+ const labelId = useId();
262
+ const detailId = useId();
263
+ const hasInlineDetails = Boolean(details && !showDetailsInOverlay);
264
+ const reserveLeadingSlot = useReserveLeadingSlot();
265
+ const hasLeadingSlot = Boolean(leadingItems) || reserveLeadingSlot;
266
+ const [detailsElement, setDetailsElement] = useState(null);
267
+ const [isDetailsHovered, setIsDetailsHovered] = useState(false);
268
+ const [hasFocusInDetails, setHasFocusInDetails] = useState(false);
269
+ const isDetailsActive = isDetailsHovered || hasFocusInDetails;
270
+ const showOverlayDetails = showDetailsInOverlay && Boolean(details) && (isFocused || isDetailsActive);
271
+ const detailsContain = (target)=>target instanceof Node && Boolean(detailsElement?.contains(target));
272
+ const itemProps = mergeProps({
273
+ 'aria-describedby': details ? detailId : void 0
274
+ }, props, {
275
+ onKeyDown: (e)=>{
276
+ if ('ArrowRight' === e.key && e.target === e.currentTarget && focusMenuItemDetails(e.currentTarget)) {
277
+ e.preventDefault();
278
+ e.stopPropagation();
279
+ }
280
+ },
281
+ onFocus: (e)=>{
282
+ if (detailsContain(e.target)) {
283
+ e.stopPropagation();
284
+ if (!detailsContain(e.relatedTarget) && e.relatedTarget instanceof HTMLElement) setReturnFocusTarget(e.relatedTarget);
285
+ setHasFocusInDetails(true);
286
+ }
287
+ },
288
+ onBlur: (e)=>{
289
+ if (detailsContain(e.target)) e.stopPropagation();
290
+ setHasFocusInDetails(detailsContain(e.relatedTarget));
291
+ }
292
+ });
293
+ const returnFocus = ()=>{
294
+ const target = returnFocusTarget?.isConnected ? returnFocusTarget : itemElement;
295
+ setReturnFocusTarget(null);
296
+ target?.focus();
297
+ };
298
+ return /*#__PURE__*/ jsxs(MenuItemWrap, {
299
+ hasTrailingAction: Boolean(trailingAction),
300
+ isFocused: isFocused || isDetailsActive,
301
+ "aria-disabled": disabled,
302
+ "aria-labelledby": labelId,
303
+ as: as ?? 'li',
304
+ ref: mergeRefs(ref, (element)=>setItemElement(element)),
305
+ "data-menu-item-details-id": showDetailsInOverlay ? detailId : void 0,
306
+ ...itemProps,
307
+ children: [
308
+ /*#__PURE__*/ jsx(Tooltip, {
309
+ skipWrapper: true,
310
+ title: 'function' == typeof tooltip ? tooltip({
311
+ disabled,
312
+ isFocused,
313
+ isSelected
314
+ }) : tooltip,
315
+ delay: 500,
316
+ ...tooltipOptions,
317
+ children: /*#__PURE__*/ jsxs(StyledInnerWrap, {
318
+ "data-menu-item-content": true,
319
+ padding: ITEM_PADDING_BY_SIZE[size ?? 'md'],
320
+ paddingLeft: hasLeadingSlot ? 'md' : void 0,
321
+ paddingRight: trailingAction ? TRAILING_ACTION_SPACE : void 0,
322
+ "data-focused": isFocused || isDetailsActive,
323
+ "data-pressed": isPressed,
324
+ hasTrailingAction: Boolean(trailingAction),
325
+ disabled: disabled,
326
+ priority: priority,
327
+ size: size,
328
+ ...innerWrapProps,
329
+ children: [
330
+ hasLeadingSlot && /*#__PURE__*/ jsx(StyledLeadingItems, {
331
+ disabled: disabled,
332
+ hasDetails: hasInlineDetails,
333
+ size: size,
334
+ children: 'function' == typeof leadingItems ? leadingItems({
335
+ disabled,
336
+ isFocused,
337
+ isSelected
338
+ }) : leadingItems
339
+ }),
340
+ /*#__PURE__*/ jsxs(StyledContentWrap, {
341
+ children: [
342
+ /*#__PURE__*/ jsxs(Stack, {
343
+ padding: hasInlineDetails ? 'xs 0' : void 0,
344
+ minHeight: hasInlineDetails ? void 0 : '24px',
345
+ justify: "center",
346
+ align: "start",
347
+ gap: "2xs",
348
+ flex: "1 0 0",
349
+ minWidth: "0",
350
+ children: [
351
+ /*#__PURE__*/ jsx(Text, {
352
+ as: "div",
353
+ size: LABEL_TEXT_SIZE_BY_SIZE[size ?? 'md'],
354
+ density: "fixed",
355
+ variant: disabled ? 'muted' : 'default' === priority ? void 0 : priority,
356
+ bold: false,
357
+ tabular: true,
358
+ ellipsis: true,
359
+ trim: 'string' == typeof label || 'number' == typeof label,
360
+ id: labelId,
361
+ "data-test-id": "menu-list-item-label",
362
+ ...labelProps,
363
+ children: label
364
+ }),
365
+ !showDetailsInOverlay && details && /*#__PURE__*/ jsx(StyledDetails, {
366
+ id: detailId,
367
+ disabled: disabled,
368
+ priority: priority,
369
+ ...detailsProps,
370
+ children: 'function' == typeof details ? details({
371
+ disabled,
372
+ isFocused,
373
+ isSelected
374
+ }) : details
375
+ })
376
+ ]
377
+ }),
378
+ trailingItems && /*#__PURE__*/ jsx(TrailingItems, {
379
+ disabled: disabled,
380
+ children: 'function' == typeof trailingItems ? trailingItems({
381
+ disabled,
382
+ isFocused,
383
+ isSelected
384
+ }) : trailingItems
385
+ })
386
+ ]
387
+ })
388
+ ]
389
+ })
390
+ }),
391
+ trailingAction && /*#__PURE__*/ jsx(Flex, {
392
+ position: "absolute",
393
+ right: theme.space[TRAILING_ACTION_INSET],
394
+ top: "0",
395
+ height: "100%",
396
+ align: "center",
397
+ ...trailingActionWrapperProps,
398
+ children: /*#__PURE__*/ jsx(Button, {
399
+ ref: trailingActionRef,
400
+ size: "zero",
401
+ variant: "transparent",
402
+ icon: trailingAction.icon,
403
+ "aria-label": trailingAction.label,
404
+ tooltipProps: {
405
+ title: trailingAction.label
406
+ },
407
+ busy: trailingAction.busy,
408
+ onClick: trailingAction.onAction
409
+ })
410
+ }),
411
+ showOverlayDetails && /*#__PURE__*/ jsx(DetailsOverlay, {
412
+ size: size,
413
+ id: detailId,
414
+ itemElement: itemElement,
415
+ labelId: labelId,
416
+ ref: setDetailsElement,
417
+ hasFocusWithin: hasFocusInDetails,
418
+ onReturnFocus: returnFocus,
419
+ onPointerEnter: (e)=>{
420
+ setIsDetailsHovered(true);
421
+ onDetailsHoverChange?.(true, e);
422
+ },
423
+ onPointerLeave: (e)=>{
424
+ setIsDetailsHovered(false);
425
+ onDetailsHoverChange?.(false, e);
426
+ },
427
+ children: 'function' == typeof details ? details({
428
+ disabled,
429
+ isFocused,
430
+ isSelected
431
+ }) : details
432
+ })
433
+ ]
434
+ });
435
+ }
436
+ const DETAILS_MIDDLEWARE = [
437
+ offset({
438
+ crossAxis: -4,
439
+ mainAxis: 8
440
+ }),
441
+ flipOverlay(),
442
+ shiftOverlay(),
443
+ hide()
444
+ ];
445
+ function focusMenuItemDetails(item) {
446
+ const detailsId = item?.getAttribute('data-menu-item-details-id');
447
+ const detailsElement = detailsId ? document.getElementById(detailsId) : null;
448
+ const firstFocusable = detailsElement ? getFocusableTreeWalker(detailsElement, {
449
+ tabbable: true
450
+ }).nextNode() : null;
451
+ if (!(firstFocusable instanceof HTMLElement)) return false;
452
+ firstFocusable.focus();
453
+ return true;
454
+ }
455
+ function getTabbableElements(root) {
456
+ const walker = getFocusableTreeWalker(root, {
457
+ tabbable: true
458
+ });
459
+ const elements = [];
460
+ let node = walker.nextNode();
461
+ while(node){
462
+ if (node instanceof HTMLElement) elements.push(node);
463
+ node = walker.nextNode();
464
+ }
465
+ return elements;
466
+ }
467
+ function DetailsOverlay({ children, hasFocusWithin, id, itemElement, labelId, onPointerEnter, onPointerLeave, onReturnFocus, ref, size }) {
468
+ const theme = useTheme();
469
+ const { t } = useTranslation();
470
+ const [contentElement, setContentElement] = useState(null);
471
+ const [isInteractive, setIsInteractive] = useState(false);
472
+ const { refs: { setFloating }, floatingStyles, middlewareData } = useFloating({
473
+ elements: {
474
+ reference: itemElement
475
+ },
476
+ placement: 'right-start',
477
+ strategy: 'fixed',
478
+ middleware: DETAILS_MIDDLEWARE,
479
+ whileElementsMounted: autoUpdate
480
+ });
481
+ const onContentElement = (element)=>{
482
+ setContentElement(element);
483
+ if (element) setIsInteractive(getTabbableElements(element).length > 0);
484
+ };
485
+ const onKeyDown = (e)=>{
486
+ if ('Escape' === e.key || 'ArrowLeft' === e.key) {
487
+ e.preventDefault();
488
+ e.stopPropagation();
489
+ onReturnFocus();
490
+ return;
491
+ }
492
+ if ('Tab' === e.key && contentElement) {
493
+ e.preventDefault();
494
+ e.stopPropagation();
495
+ const tabbables = getTabbableElements(contentElement);
496
+ const index = tabbables.indexOf(e.target);
497
+ const next = e.shiftKey ? tabbables[index <= 0 ? tabbables.length - 1 : index - 1] : tabbables[(index + 1) % tabbables.length];
498
+ next?.focus();
499
+ }
500
+ };
501
+ if (!itemElement) return null;
502
+ return /*#__PURE__*/ createPortal(/*#__PURE__*/ jsx(StyledPositionWrapper, {
503
+ "data-reference-hidden": middlewareData.hide?.referenceHidden,
504
+ ref: setFloating,
505
+ zIndex: theme.zIndex.tooltip,
506
+ style: floatingStyles,
507
+ children: /*#__PURE__*/ jsx(FocusScope, {
508
+ children: /*#__PURE__*/ jsxs(StyledOverlay, {
509
+ id: id,
510
+ ref: mergeRefs(ref, onContentElement),
511
+ role: isInteractive ? 'dialog' : 'tooltip',
512
+ "aria-labelledby": isInteractive ? itemElement.getAttribute('aria-labelledby') ?? labelId : void 0,
513
+ placement: "right-start",
514
+ size: size,
515
+ "data-menu-item-details": true,
516
+ onKeyDown: onKeyDown,
517
+ onPointerEnter: onPointerEnter,
518
+ onPointerLeave: onPointerLeave,
519
+ children: [
520
+ children,
521
+ isInteractive && !hasFocusWithin ? /*#__PURE__*/ jsx(VisuallyHidden, {
522
+ children: t('Press Right Arrow to interact with details.')
523
+ }) : null
524
+ ]
525
+ })
526
+ })
527
+ }), itemElement.closest('[data-overlay-root]') ?? document.body);
528
+ }
529
+ const StyledPositionWrapper = styled(PositionWrapper)`
530
+ &[data-reference-hidden='true'] {
531
+ opacity: 0;
532
+ pointer-events: none;
533
+ }
534
+ `;
535
+ const StyledOverlay = styled(Overlay)`
536
+ padding: 4px;
537
+ font-size: ${(p)=>p.theme.form[p.size ?? 'md'].fontSize};
538
+ cursor: auto;
539
+ user-select: contain;
540
+ max-height: 80vh;
541
+ overflow: auto;
542
+ `;
543
+ const MenuItemWrap = styled('li')`
544
+ position: ${(p)=>p.hasTrailingAction ? 'relative' : 'static'};
545
+ ${(p)=>p.hasTrailingAction && p.isFocused && 'z-index: 1;'}
546
+ list-style-type: none;
547
+ margin: 0;
548
+ padding: 0 ${(p)=>p.theme.space.xs};
549
+ cursor: pointer;
550
+ scroll-margin: ${(p)=>p.theme.space.xs} 0;
551
+
552
+ &:focus {
553
+ outline: none;
554
+ }
555
+ &:focus-visible {
556
+ outline: none;
557
+ }
558
+ `;
559
+ const TrailingItems = styled('div')`
560
+ display: flex;
561
+ align-items: center;
562
+ height: 24px;
563
+ gap: ${(p)=>p.theme.space.md};
564
+ margin-right: ${(p)=>p.theme.space.xs};
565
+
566
+ ${(p)=>p.disabled && 'opacity: 0.5;'}
567
+ `;
568
+ export { MenuFooterLayout, MenuHeaderLayout, MenuHeading, MenuListItem, MenuSectionGroup, MenuSectionHeader, MenuSectionLabel, MenuSectionList, MenuSectionSeparator, ReserveLeadingSlot, SECTION_ITEM_SPACE, SearchInput, calculateMenuMinHeight, focusMenuItemDetails, useReserveLeadingSlot };
@@ -0,0 +1,96 @@
1
+ import type * as React from 'react';
2
+ import type { SelectValue } from './selectValue.js';
3
+ export type ListItemBase = object & {
4
+ showToggleAllButton?: boolean;
5
+ };
6
+ export type SelectKey = string | number;
7
+ export interface SelectOption<Value extends SelectKey> extends SelectValue<Value> {
8
+ /**
9
+ * Whether to hide the checkbox/checkmark. Available for backward compatibility only.
10
+ * If true, an alternative selection state indicator must be present.
11
+ *
12
+ * @deprecated
13
+ */
14
+ hideCheck?: boolean;
15
+ }
16
+ export interface SelectSection<Value extends SelectKey> {
17
+ options: Array<SelectOption<Value>>;
18
+ /**
19
+ * When true, all options inside this section will be disabled.
20
+ */
21
+ disabled?: boolean;
22
+ /**
23
+ * Optional key to identify this section. If not specified, the section's index will
24
+ * be used.
25
+ */
26
+ key?: SelectKey;
27
+ /**
28
+ * Title to display in the section header.
29
+ */
30
+ label?: React.ReactNode;
31
+ /**
32
+ * Whether to show a "Select All"/"Unselect All" button in the section header (only
33
+ * applicable in multiple-selection mode).
34
+ */
35
+ showToggleAllButton?: boolean;
36
+ }
37
+ export type SelectOptionOrSection<Value extends SelectKey> = SelectOption<Value> | SelectSection<Value>;
38
+ /**
39
+ * The result of a custom `searchMatcher` function. Returning this (instead of a plain
40
+ * boolean) allows callers to influence how matching options are sorted: options with a
41
+ * higher `score` are shown first. To hide an option, return `{score: 0}.
42
+ */
43
+ export interface SearchMatchResult {
44
+ /**
45
+ * Match quality score. Higher values cause the option to appear earlier in the list.
46
+ * Options that match but return no score maintain their original order relative to
47
+ * each other.
48
+ */
49
+ score: number;
50
+ }
51
+ /**
52
+ * Configuration for CompactSelect's search/filter behavior. Providing this prop
53
+ * implicitly enables the search input.
54
+ */
55
+ export interface SearchConfig<Value extends SelectKey> {
56
+ /**
57
+ * Controls client-side option filtering:
58
+ * - Omitted: default fuzzy (fzf) filter, results sorted by match score
59
+ * - Function: custom matcher (receives option + search string, returns SearchMatchResult)
60
+ * - `false`: disables client-side filtering entirely (use with `onChange` for server-side search)
61
+ */
62
+ filter?: ((option: SelectOptionWithKey<Value>, search: string) => SearchMatchResult) | false;
63
+ /**
64
+ * When true, the matched contiguous substring of each option's (string) label will be
65
+ * visually highlighted as the user types. Paired best with a substring-based `filter` function.
66
+ */
67
+ highlight?: boolean;
68
+ /**
69
+ * Called when the search input value changes.
70
+ */
71
+ onChange?: (value: string) => void;
72
+ /**
73
+ * Placeholder text for the search input. Defaults to 'Search…'.
74
+ */
75
+ placeholder?: string;
76
+ }
77
+ export interface SelectOptionWithKey<Value extends SelectKey> extends SelectOption<Value> {
78
+ /**
79
+ * Key to identify this section. If not specified, the section's index will
80
+ * be used.
81
+ */
82
+ key: SelectKey;
83
+ }
84
+ export interface SelectSectionWithKey<Value extends SelectKey> extends SelectSection<Value> {
85
+ /**
86
+ * Key to identify this section. If not specified, the section's index will
87
+ * be used.
88
+ */
89
+ key: SelectKey;
90
+ options: Array<SelectOptionWithKey<Value>>;
91
+ }
92
+ /**
93
+ * Select option/section type used for internal selection manager. DO NOT import in
94
+ * other components. Import `SelectOptionOrSection` instead.
95
+ */
96
+ export type SelectOptionOrSectionWithKey<Value extends SelectKey> = SelectOptionWithKey<Value> | SelectSectionWithKey<Value>;
File without changes
@@ -0,0 +1,13 @@
1
+ import type { ListItemProps } from './menu.js';
2
+ /**
3
+ * The option format used by react-select based components
4
+ */
5
+ export interface SelectValue<T> extends ListItemProps {
6
+ value: T;
7
+ /**
8
+ * In scenarios where you're using a react element as the label react-select
9
+ * will be unable to filter to that label. Use this to specify the plain text of
10
+ * the label.
11
+ */
12
+ textValue?: string;
13
+ }
File without changes