@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.
- package/README.md +6 -5
- package/dist/alert/alert.js +0 -3
- package/dist/badge/badge.js +1 -2
- package/dist/badge/tag.js +0 -2
- package/dist/button/index.d.ts +0 -1
- package/dist/button/index.js +0 -1
- package/dist/clipboard/copyToClipboardButton.d.ts +15 -0
- package/dist/clipboard/copyToClipboardButton.js +32 -0
- package/dist/clipboard/index.d.ts +1 -0
- package/dist/clipboard/index.js +1 -0
- package/dist/code/index.d.ts +1 -0
- package/dist/code/index.js +1 -0
- package/dist/codeBlock/codeBlock.d.ts +68 -0
- package/dist/codeBlock/codeBlock.js +242 -0
- package/dist/codeBlock/index.d.ts +2 -0
- package/dist/codeBlock/index.js +2 -0
- package/dist/codeBlock/prism.d.ts +11 -0
- package/dist/codeBlock/prism.js +101 -0
- package/dist/codeBlock/styles.d.ts +2 -0
- package/dist/codeBlock/styles.js +133 -0
- package/dist/compactSelect/compactSelect.d.ts +21 -0
- package/dist/compactSelect/compactSelect.js +150 -0
- package/dist/compactSelect/composite.d.ts +54 -0
- package/dist/compactSelect/composite.js +101 -0
- package/dist/compactSelect/control.d.ts +112 -0
- package/dist/compactSelect/control.js +354 -0
- package/dist/compactSelect/fzf.d.ts +8 -0
- package/dist/compactSelect/fzf.js +151 -0
- package/dist/compactSelect/gridList/index.d.ts +46 -0
- package/dist/compactSelect/gridList/index.js +102 -0
- package/dist/compactSelect/gridList/option.d.ts +15 -0
- package/dist/compactSelect/gridList/option.js +111 -0
- package/dist/compactSelect/gridList/section.d.ts +15 -0
- package/dist/compactSelect/gridList/section.js +58 -0
- package/dist/compactSelect/highlightText.d.ts +6 -0
- package/dist/compactSelect/highlightText.js +33 -0
- package/dist/compactSelect/index.d.ts +9 -0
- package/dist/compactSelect/index.js +8 -0
- package/dist/compactSelect/list.d.ts +94 -0
- package/dist/compactSelect/list.js +167 -0
- package/dist/compactSelect/listBox/index.d.ts +84 -0
- package/dist/compactSelect/listBox/index.js +175 -0
- package/dist/compactSelect/listBox/option.d.ts +19 -0
- package/dist/compactSelect/listBox/option.js +101 -0
- package/dist/compactSelect/listBox/section.d.ts +21 -0
- package/dist/compactSelect/listBox/section.js +58 -0
- package/dist/compactSelect/menuComponents.d.ts +89 -0
- package/dist/compactSelect/menuComponents.js +117 -0
- package/dist/compactSelect/selectFilterContext.d.ts +2 -0
- package/dist/compactSelect/selectFilterContext.js +3 -0
- package/dist/compactSelect/styles.d.ts +39 -0
- package/dist/compactSelect/styles.js +155 -0
- package/dist/compactSelect/types.d.ts +1 -0
- package/dist/compactSelect/types.js +0 -0
- package/dist/compactSelect/useVirtualizedItems.d.ts +52 -0
- package/dist/compactSelect/useVirtualizedItems.js +74 -0
- package/dist/compactSelect/utils.d.ts +80 -0
- package/dist/compactSelect/utils.js +268 -0
- package/dist/confirm/index.d.ts +153 -0
- package/dist/confirm/index.js +132 -0
- package/dist/descriptionList/descriptionList.js +4 -3
- package/dist/disclosure/disclosure.js +2 -2
- package/dist/dragHandle/dragHandle.d.ts +3 -1
- package/dist/dragHandle/dragHandle.js +8 -5
- package/dist/drawer/components.d.ts +46 -0
- package/dist/drawer/components.js +265 -0
- package/dist/drawer/globalDrawer.d.ts +106 -0
- package/dist/drawer/globalDrawer.js +173 -0
- package/dist/drawer/index.d.ts +3 -0
- package/dist/drawer/index.js +2 -0
- package/dist/drawer/useDrawerResizing.d.ts +19 -0
- package/dist/drawer/useDrawerResizing.js +111 -0
- package/dist/drawer/useDrawerWidth.d.ts +1 -0
- package/dist/drawer/useDrawerWidth.js +42 -0
- package/dist/dropdownMenu/content.d.ts +1 -0
- package/dist/dropdownMenu/content.js +1 -0
- package/dist/dropdownMenu/context.d.ts +24 -0
- package/dist/dropdownMenu/context.js +3 -0
- package/dist/dropdownMenu/dropdownMenu.d.ts +70 -0
- package/dist/dropdownMenu/dropdownMenu.js +103 -0
- package/dist/dropdownMenu/index.d.ts +2 -0
- package/dist/dropdownMenu/index.js +1 -0
- package/dist/dropdownMenu/item.d.ts +136 -0
- package/dist/dropdownMenu/item.js +182 -0
- package/dist/dropdownMenu/list.d.ts +59 -0
- package/dist/dropdownMenu/list.js +410 -0
- package/dist/dropdownMenu/search.d.ts +16 -0
- package/dist/dropdownMenu/search.js +16 -0
- package/dist/dropdownMenu/section.d.ts +21 -0
- package/dist/dropdownMenu/section.js +40 -0
- package/dist/dropdownMenu/separator.d.ts +7 -0
- package/dist/dropdownMenu/separator.js +15 -0
- package/dist/dropdownMenu/useDropdownMenuKeyboard.d.ts +260 -0
- package/dist/dropdownMenu/useDropdownMenuKeyboard.js +55 -0
- package/dist/dropdownMenu/useDropdownMenuRowLayout.d.ts +29 -0
- package/dist/dropdownMenu/useDropdownMenuRowLayout.js +64 -0
- package/dist/dropdownMenu/useSafetyTriangle.d.ts +12 -0
- package/dist/dropdownMenu/useSafetyTriangle.js +119 -0
- package/dist/dropdownMenu/utils.d.ts +21 -0
- package/dist/dropdownMenu/utils.js +57 -0
- package/dist/form/FormSearch.d.ts +19 -0
- package/dist/form/FormSearch.js +4 -0
- package/dist/form/autoSaveForm.d.ts +110 -0
- package/dist/form/autoSaveForm.js +100 -0
- package/dist/{formPresentation → form}/displayField.js +2 -2
- package/dist/form/field/baseField.d.ts +23 -0
- package/dist/form/field/baseField.js +116 -0
- package/dist/form/field/checkboxField.d.ts +11 -0
- package/dist/form/field/checkboxField.js +42 -0
- package/dist/form/field/checkboxGroupField.d.ts +16 -0
- package/dist/form/field/checkboxGroupField.js +80 -0
- package/dist/form/field/compactSelectField.d.ts +19 -0
- package/dist/form/field/compactSelectField.js +77 -0
- package/dist/{formPresentation → form/field}/fieldIds.js +1 -1
- package/dist/form/field/inputField.d.ts +19 -0
- package/dist/form/field/inputField.js +31 -0
- package/dist/{formPresentation → form/field}/meta.js +6 -6
- package/dist/form/field/numberField.d.ts +5 -0
- package/dist/form/field/numberField.js +11 -0
- package/dist/form/field/passwordField.d.ts +3 -0
- package/dist/form/field/passwordField.js +27 -0
- package/dist/form/field/radioGroupField.d.ts +16 -0
- package/dist/form/field/radioGroupField.js +92 -0
- package/dist/form/field/rangeField.d.ts +8 -0
- package/dist/form/field/rangeField.js +34 -0
- package/dist/form/field/selectAsyncField.d.ts +31 -0
- package/dist/form/field/selectAsyncField.js +22 -0
- package/dist/form/field/selectField.d.ts +9 -0
- package/dist/form/field/selectField.js +72 -0
- package/dist/form/field/switchField.d.ts +7 -0
- package/dist/form/field/switchField.js +37 -0
- package/dist/form/field/textAreaField.d.ts +7 -0
- package/dist/form/field/textAreaField.js +25 -0
- package/dist/{formPresentation → form}/formContext.js +1 -1
- package/dist/form/formErrorContext/index.d.ts +9 -0
- package/dist/form/formErrorContext/index.js +7 -0
- package/dist/form/index.d.ts +9 -0
- package/dist/form/index.js +8 -0
- package/dist/{formPresentation → form/layout}/base.d.ts +1 -1
- package/dist/{formPresentation → form/layout}/base.js +1 -1
- package/dist/form/layout/fieldGroup.d.ts +6 -0
- package/dist/form/layout/fieldGroup.js +60 -0
- package/dist/{formPresentation/fieldLayout.d.ts → form/layout/index.d.ts} +1 -1
- package/dist/{formPresentation/fieldLayout.js → form/layout/index.js} +3 -3
- package/dist/{formPresentation → form/layout}/useStackedLayout.js +1 -1
- package/dist/form/scrapsForm.d.ts +220 -0
- package/dist/form/scrapsForm.js +126 -0
- package/dist/hotkey/hotkey.d.ts +9 -8
- package/dist/hotkey/hotkey.js +13 -6
- package/dist/hotkey/index.d.ts +2 -1
- package/dist/hotkey/index.js +2 -1
- package/dist/hotkey/keyMappings.d.ts +1 -15
- package/dist/hotkey/keyMappings.js +29 -174
- package/dist/hotkey/useHotkeys.d.ts +3 -47
- package/dist/hotkey/useHotkeys.js +8 -42
- package/dist/image/image.js +2 -1
- package/dist/info/infoTip.d.ts +1 -1
- package/dist/info/infoTip.js +4 -3
- package/dist/input/index.d.ts +0 -3
- package/dist/input/index.js +0 -2
- package/dist/input/input.d.ts +2 -0
- package/dist/input/input.js +2 -0
- package/dist/input/passwordManagerIgnoreProps.d.ts +11 -0
- package/dist/input/passwordManagerIgnoreProps.js +8 -0
- package/dist/layout/index.d.ts +2 -2
- package/dist/layout/index.js +1 -1
- package/dist/layout/styles.d.ts +1 -1
- package/dist/link/link.js +4 -3
- package/dist/link/linkBehaviorContext.d.ts +2 -0
- package/dist/link/linkBehaviorContext.js +17 -10
- package/dist/menu/controlContext.d.ts +32 -0
- package/dist/menu/controlContext.js +7 -0
- package/dist/menu/dropdownButton.d.ts +18 -0
- package/dist/menu/dropdownButton.js +66 -0
- package/dist/menu/index.d.ts +7 -0
- package/dist/menu/index.js +3 -0
- package/dist/menu/menu.d.ts +167 -0
- package/dist/menu/menu.js +568 -0
- package/dist/menu/selectTypes.d.ts +96 -0
- package/dist/menu/selectTypes.js +0 -0
- package/dist/menu/selectValue.d.ts +13 -0
- package/dist/menu/selectValue.js +0 -0
- package/dist/modal/components.d.ts +19 -0
- package/dist/modal/components.js +99 -0
- package/dist/modal/errorBoundary.d.ts +2 -0
- package/dist/modal/errorBoundary.js +35 -0
- package/dist/modal/index.d.ts +33 -0
- package/dist/modal/index.js +260 -0
- package/dist/modal/portal.d.ts +1 -0
- package/dist/modal/portal.js +10 -0
- package/dist/modal/state.d.ts +17 -0
- package/dist/modal/state.js +41 -0
- package/dist/modal/types.d.ts +75 -0
- package/dist/modal/types.js +0 -0
- package/dist/numberInput/index.d.ts +3 -0
- package/dist/numberInput/index.js +2 -0
- package/dist/{input → numberInput}/numberDragInput.d.ts +1 -1
- package/dist/{input → numberInput}/numberDragInput.js +1 -1
- package/dist/{input → numberInput}/numberInput.d.ts +1 -1
- package/dist/{input → numberInput}/numberInput.js +1 -1
- package/dist/overlayContext.d.ts +29 -0
- package/dist/overlayContext.js +7 -0
- package/dist/overlayTrigger.d.ts +22 -0
- package/dist/overlayTrigger.js +30 -0
- package/dist/pagination/index.d.ts +1 -0
- package/dist/pagination/index.js +1 -0
- package/dist/pagination/pagination.d.ts +24 -0
- package/dist/pagination/pagination.js +63 -0
- package/dist/pictureInPicture/index.d.ts +2 -0
- package/dist/pictureInPicture/index.js +2 -0
- package/dist/pictureInPicture/pictureInPicture.d.ts +47 -0
- package/dist/pictureInPicture/pictureInPicture.js +100 -0
- package/dist/pictureInPicture/pictureInPicturePortal.d.ts +16 -0
- package/dist/pictureInPicture/pictureInPicturePortal.js +46 -0
- package/dist/pictureInPicture/portalContext.d.ts +2 -0
- package/dist/pictureInPicture/portalContext.js +3 -0
- package/dist/revealOnHover/revealOnHover.js +1 -1
- package/dist/segmentedControl/segmentedControl.js +1 -1
- package/dist/select/filter.d.ts +4 -0
- package/dist/select/filter.js +12 -0
- package/dist/select/index.d.ts +3 -0
- package/dist/select/index.js +2 -0
- package/dist/select/option.d.ts +16 -0
- package/dist/select/option.js +81 -0
- package/dist/select/reactSelectWrapper.d.ts +8 -0
- package/dist/select/reactSelectWrapper.js +25 -0
- package/dist/select/select.d.ts +79 -0
- package/dist/select/select.js +454 -0
- package/dist/select/styles.d.ts +9 -0
- package/dist/select/styles.js +27 -0
- package/dist/select/types.d.ts +60 -0
- package/dist/select/types.js +0 -0
- package/dist/select/virtualizedMenuList.d.ts +24 -0
- package/dist/select/virtualizedMenuList.js +123 -0
- package/dist/slideOverPanel.d.ts +20 -0
- package/dist/slideOverPanel.js +141 -0
- package/dist/slot/knownContexts.d.ts +1 -1
- package/dist/spinner/index.d.ts +1 -0
- package/dist/spinner/index.js +1 -0
- package/dist/spinner/spinner.d.ts +14 -0
- package/dist/spinner/spinner.js +126 -0
- package/dist/splitPanel/index.d.ts +1 -0
- package/dist/splitPanel/index.js +1 -0
- package/dist/splitPanel/splitPanel.d.ts +38 -0
- package/dist/splitPanel/splitPanel.js +145 -0
- package/dist/table/table.d.ts +1 -1
- package/dist/table/table.js +39 -20
- package/dist/table/useColumnResize.d.ts +6 -5
- package/dist/table/useColumnResize.js +5 -4
- package/dist/tabs/index.d.ts +4 -0
- package/dist/tabs/index.js +3 -0
- package/dist/tabs/item.d.ts +13 -0
- package/dist/tabs/item.js +4 -0
- package/dist/tabs/tab.d.ts +22 -0
- package/dist/tabs/tab.js +205 -0
- package/dist/tabs/tabList.d.ts +18 -0
- package/dist/tabs/tabList.js +256 -0
- package/dist/tabs/tabPanels.d.ts +14 -0
- package/dist/tabs/tabPanels.js +62 -0
- package/dist/tabs/tabs.d.ts +38 -0
- package/dist/tabs/tabs.js +56 -0
- package/dist/tabs/utils.d.ts +3 -0
- package/dist/tabs/utils.js +6 -0
- package/dist/text/heading.d.ts +1 -1
- package/dist/text/heading.js +1 -1
- package/dist/text/styles.js +1 -1
- package/dist/text/text.d.ts +1 -1
- package/dist/text/text.js +1 -1
- package/dist/theme/dark.js +9 -9
- package/dist/theme/light.js +9 -9
- package/dist/toast/index.d.ts +5 -0
- package/dist/toast/index.js +4 -0
- package/dist/toast/toast.d.ts +10 -0
- package/dist/toast/toast.js +182 -0
- package/dist/toast/toastApi.d.ts +10 -0
- package/dist/toast/toastApi.js +53 -0
- package/dist/toast/toaster.d.ts +4 -0
- package/dist/toast/toaster.js +42 -0
- package/dist/toast/types.d.ts +17 -0
- package/dist/toast/types.js +2 -0
- package/dist/toggleCard/index.d.ts +1 -0
- package/dist/toggleCard/index.js +1 -0
- package/dist/toggleCard/toggleCard.d.ts +32 -0
- package/dist/toggleCard/toggleCard.js +301 -0
- package/dist/tooltip/tooltip.js +2 -5
- package/dist/useDimensions.d.ts +12 -0
- package/dist/useDimensions.js +31 -0
- package/dist/useMedia.d.ts +15 -0
- package/dist/useMedia.js +24 -0
- package/dist/useOnClickOutside.d.ts +2 -0
- package/dist/useOnClickOutside.js +22 -0
- package/dist/useOverlay.d.ts +1 -0
- package/dist/useOverlay.js +1 -0
- package/dist/useResizableDrawer.d.ts +72 -0
- package/dist/useResizableDrawer.js +136 -0
- package/dist/useVirtualCollection.d.ts +154 -0
- package/dist/useVirtualCollection.js +143 -0
- package/dist/useVirtualRows.d.ts +26 -0
- package/dist/useVirtualRows.js +26 -0
- package/dist/virtualCollectionLayout.d.ts +51 -0
- package/dist/virtualCollectionLayout.js +49 -0
- package/package.json +148 -16
- package/dist/formPresentation/index.d.ts +0 -8
- package/dist/formPresentation/index.js +0 -8
- package/dist/interactionStateLayer/index.d.ts +0 -1
- package/dist/interactionStateLayer/index.js +0 -1
- package/dist/interactionStateLayer/interactionStateLayer.d.ts +0 -23
- package/dist/interactionStateLayer/interactionStateLayer.js +0 -67
- package/dist/unreachable.d.ts +0 -1
- package/dist/unreachable.js +0 -4
- /package/dist/{formPresentation → form}/autoSaveContext.d.ts +0 -0
- /package/dist/{formPresentation → form}/autoSaveContext.js +0 -0
- /package/dist/{formPresentation → form}/displayField.d.ts +0 -0
- /package/dist/{formPresentation → form/field}/fieldIds.d.ts +0 -0
- /package/dist/{formPresentation → form/field}/groupContext.d.ts +0 -0
- /package/dist/{formPresentation → form/field}/groupContext.js +0 -0
- /package/dist/{formPresentation → form/field}/meta.d.ts +0 -0
- /package/dist/{formPresentation → form}/formContext.d.ts +0 -0
- /package/dist/{formPresentation → form}/icons.d.ts +0 -0
- /package/dist/{formPresentation → form}/icons.js +0 -0
- /package/dist/{formPresentation → form/layout}/useStackedLayout.d.ts +0 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx, jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { css } from "@emotion/react";
|
|
3
|
+
import styled from "@emotion/styled";
|
|
4
|
+
import { IconChevron } from "@sentry/icons/chevron";
|
|
5
|
+
import { Button } from "../button/index.js";
|
|
6
|
+
import { useResponsivePropValue } from "../layout/index.js";
|
|
7
|
+
import { useSizeContext } from "../sizeContext.js";
|
|
8
|
+
function DropdownButton({ children, prefix, size: explicitSize, isOpen = false, showChevron = true, disabled = false, ref, onClick, ...props }) {
|
|
9
|
+
const contextSize = useSizeContext();
|
|
10
|
+
const size = useResponsivePropValue(explicitSize ?? contextSize ?? 'md');
|
|
11
|
+
return /*#__PURE__*/ jsxs(StyledButton, {
|
|
12
|
+
"aria-haspopup": "true",
|
|
13
|
+
"aria-expanded": isOpen,
|
|
14
|
+
hasPrefix: !!prefix,
|
|
15
|
+
disabled: disabled,
|
|
16
|
+
isOpen: isOpen,
|
|
17
|
+
size: size,
|
|
18
|
+
ref: ref,
|
|
19
|
+
...props,
|
|
20
|
+
onClick: (event)=>{
|
|
21
|
+
event.preventDefault();
|
|
22
|
+
event.stopPropagation();
|
|
23
|
+
onClick?.(event);
|
|
24
|
+
},
|
|
25
|
+
children: [
|
|
26
|
+
prefix && /*#__PURE__*/ jsx(LabelText, {
|
|
27
|
+
children: prefix
|
|
28
|
+
}),
|
|
29
|
+
children,
|
|
30
|
+
showChevron && /*#__PURE__*/ jsx(ChevronWrap, {
|
|
31
|
+
children: /*#__PURE__*/ jsx(IconChevron, {
|
|
32
|
+
variant: (props.variant ?? 'secondary') === 'secondary' ? 'muted' : void 0,
|
|
33
|
+
direction: isOpen ? 'up' : 'down',
|
|
34
|
+
size: 'zero' === size || 'xs' === size ? 'xs' : 'sm'
|
|
35
|
+
})
|
|
36
|
+
})
|
|
37
|
+
]
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
const ChevronWrap = styled('div')`
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
margin-left: auto;
|
|
44
|
+
padding-left: ${(p)=>p.theme.space.xs};
|
|
45
|
+
flex-shrink: 0;
|
|
46
|
+
`;
|
|
47
|
+
const StyledButton = styled(Button)`
|
|
48
|
+
position: relative;
|
|
49
|
+
max-width: 100%;
|
|
50
|
+
|
|
51
|
+
${(p)=>(p.isOpen || p.disabled) && css`
|
|
52
|
+
box-shadow: none;
|
|
53
|
+
`}
|
|
54
|
+
${(p)=>p.hasPrefix && css`
|
|
55
|
+
font-weight: ${p.theme.font.weight.sans.regular};
|
|
56
|
+
`}
|
|
57
|
+
`;
|
|
58
|
+
const LabelText = styled('span')`
|
|
59
|
+
&:after {
|
|
60
|
+
content: ':';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
font-weight: ${(p)=>p.theme.font.weight.sans.medium};
|
|
64
|
+
padding-right: ${(p)=>p.theme.space.sm};
|
|
65
|
+
`;
|
|
66
|
+
export { DropdownButton };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Shared presentation; consumers own state, keyboard behavior, and ARIA roles. */
|
|
2
|
+
export { calculateMenuMinHeight, MenuFooterLayout as Footer, MenuHeaderLayout as Header, MenuHeading as Title, MenuSectionLabel as SectionLabel, MenuSectionHeader as SectionHeader, MenuSectionGroup as SectionGroup, MenuSectionList as SectionList, MenuListItem as ListItem, ReserveLeadingSlot, MenuSectionSeparator as SectionSeparator, SECTION_ITEM_SPACE, SearchInput as Search, useReserveLeadingSlot, focusMenuItemDetails, } from './menu.js';
|
|
3
|
+
export type { ListItemProps, MenuItemTrailingAction } from './menu.js';
|
|
4
|
+
export { ControlContext } from './controlContext.js';
|
|
5
|
+
export { DropdownButton, type DropdownButtonProps } from './dropdownButton.js';
|
|
6
|
+
export type { SelectValue } from './selectValue.js';
|
|
7
|
+
export type * from './selectTypes.js';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { MenuFooterLayout as Footer, MenuHeaderLayout as Header, MenuHeading as Title, MenuListItem as ListItem, MenuSectionGroup as SectionGroup, MenuSectionHeader as SectionHeader, MenuSectionLabel as SectionLabel, MenuSectionList as SectionList, MenuSectionSeparator as SectionSeparator, ReserveLeadingSlot, SECTION_ITEM_SPACE, SearchInput as Search, calculateMenuMinHeight, focusMenuItemDetails, useReserveLeadingSlot } from "./menu.js";
|
|
2
|
+
export { ControlContext } from "./controlContext.js";
|
|
3
|
+
export { DropdownButton } from "./dropdownButton.js";
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import { InputGroup } from '../input/index.js';
|
|
3
|
+
import { type FlexProps } from '../layout/index.js';
|
|
4
|
+
import type { ContainerProps } from '../layout/container.js';
|
|
5
|
+
import { Text } from '../text/index.js';
|
|
6
|
+
import type { FormSize } from '../theme/index.js';
|
|
7
|
+
import type { TooltipProps } from '../tooltip/index.js';
|
|
8
|
+
/** Caps a requested menu height by the space available to its overlay. */
|
|
9
|
+
export declare function calculateMenuMinHeight(first: string | number | undefined, second: string | number | undefined): string | undefined;
|
|
10
|
+
/** Container for a menu header, with a divider below it. */
|
|
11
|
+
export declare function MenuHeaderLayout(props: FlexProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
12
|
+
/** Text style for the menu's main heading. */
|
|
13
|
+
export declare function MenuHeading({ children, padding, }: {
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
padding?: ContainerProps['padding'];
|
|
16
|
+
}): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
17
|
+
/** Text style for a heading within a menu section. */
|
|
18
|
+
export declare function MenuSectionLabel({ children, padding, size, ...props }: Omit<React.HTMLAttributes<HTMLSpanElement>, 'color' | 'style'> & {
|
|
19
|
+
children: React.ReactNode;
|
|
20
|
+
padding?: ContainerProps['padding'];
|
|
21
|
+
size?: React.ComponentProps<typeof Text>['size'];
|
|
22
|
+
}): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
23
|
+
/** Layout for a menu section heading and an optional action beside it. */
|
|
24
|
+
export declare function MenuSectionHeader({ children, trailingAction, ...props }: FlexProps & {
|
|
25
|
+
trailingAction?: React.ReactNode;
|
|
26
|
+
}): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
27
|
+
/** Divider between menu sections. */
|
|
28
|
+
export declare function MenuSectionSeparator(): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
29
|
+
/** List item wrapper for a menu section. */
|
|
30
|
+
export declare function MenuSectionGroup(props: ContainerProps<'li'>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
31
|
+
/** List wrapper for the items within a menu section. */
|
|
32
|
+
export declare function MenuSectionList(props: FlexProps<'ul'>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
33
|
+
/** Container for menu footer actions, with a divider above it. */
|
|
34
|
+
export declare function MenuFooterLayout(props: FlexProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
35
|
+
type SearchInputProps = React.ComponentPropsWithRef<typeof InputGroup.Input> & {
|
|
36
|
+
padding?: ContainerProps['padding'];
|
|
37
|
+
};
|
|
38
|
+
/** Shared search field with a leading icon for menu controls. */
|
|
39
|
+
export declare function SearchInput({ padding, ...props }: SearchInputProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
40
|
+
/**
|
|
41
|
+
* When `reserve` is true, items without leading items render an empty leading
|
|
42
|
+
* slot, so their labels line up with items that have an icon. Menus should set
|
|
43
|
+
* it whenever any of their items renders leading items.
|
|
44
|
+
*/
|
|
45
|
+
export declare function ReserveLeadingSlot({ reserve, children, }: {
|
|
46
|
+
children: React.ReactNode;
|
|
47
|
+
reserve: boolean;
|
|
48
|
+
}): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
49
|
+
/** Whether the surrounding menu reserves a leading slot for every item. */
|
|
50
|
+
export declare function useReserveLeadingSlot(): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Menu item priority. Determines the text color.
|
|
53
|
+
*/
|
|
54
|
+
type Priority = 'primary' | 'danger' | 'default';
|
|
55
|
+
/** Space token between the items of a dropdown menu section. */
|
|
56
|
+
export declare const SECTION_ITEM_SPACE = "2xs";
|
|
57
|
+
declare const StyledInnerWrap: import("@emotion/styled").StyledComponent<((FlexProps<import("../layout/container.js").ContainerElement> | import("../layout/flex.js").FlexPropsWithRenderFunction<import("../layout/container.js").ContainerElement>) & {
|
|
58
|
+
theme?: import("@emotion/react").Theme;
|
|
59
|
+
}) & {
|
|
60
|
+
disabled: boolean;
|
|
61
|
+
hasTrailingAction: boolean;
|
|
62
|
+
priority: Priority;
|
|
63
|
+
size?: FormSize;
|
|
64
|
+
}, {}, {}>;
|
|
65
|
+
declare const StyledDetails: import("@emotion/styled").StyledComponent<{
|
|
66
|
+
theme?: import("@emotion/react").Theme;
|
|
67
|
+
as?: React.ElementType;
|
|
68
|
+
} & {
|
|
69
|
+
disabled: boolean;
|
|
70
|
+
priority: Priority;
|
|
71
|
+
}, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
72
|
+
/**
|
|
73
|
+
* A renderable item. Either a React node, or a function that accepts properties
|
|
74
|
+
* of the item, and returns a React node. The function version is useful for
|
|
75
|
+
* lazily rendering supplementary content like training items and tooltips.
|
|
76
|
+
*/
|
|
77
|
+
type ExtraContent = React.ReactNode | ((state: {
|
|
78
|
+
disabled: boolean;
|
|
79
|
+
isFocused: boolean;
|
|
80
|
+
isSelected: boolean;
|
|
81
|
+
}) => React.ReactNode);
|
|
82
|
+
/**
|
|
83
|
+
* An icon-only button rendered beside, rather than inside, the focusable menu
|
|
84
|
+
* item. The item reserves space for exactly one button, so the shape is limited
|
|
85
|
+
* to what that button needs.
|
|
86
|
+
*/
|
|
87
|
+
export interface MenuItemTrailingAction {
|
|
88
|
+
icon: React.ReactNode;
|
|
89
|
+
/** Accessible name for the button, also shown as its tooltip. */
|
|
90
|
+
label: string;
|
|
91
|
+
onAction: () => void;
|
|
92
|
+
/** Shows a loading indicator in place of the icon while the action runs. */
|
|
93
|
+
busy?: boolean;
|
|
94
|
+
}
|
|
95
|
+
export type ListItemProps = {
|
|
96
|
+
/**
|
|
97
|
+
* Optional descriptive text. Like 'label', should preferably be a string or
|
|
98
|
+
* have appropriate aria-labels.
|
|
99
|
+
*/
|
|
100
|
+
details?: ExtraContent;
|
|
101
|
+
/**
|
|
102
|
+
* Whether the item is disabled (if true, the item will be grayed out and
|
|
103
|
+
* non-interactive).
|
|
104
|
+
*/
|
|
105
|
+
disabled?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Item label. Should preferably be a string. If not, make sure that
|
|
108
|
+
* there are appropriate aria-labels.
|
|
109
|
+
*/
|
|
110
|
+
label?: React.ReactNode;
|
|
111
|
+
/**
|
|
112
|
+
* Items to be added to the left of the label
|
|
113
|
+
*/
|
|
114
|
+
leadingItems?: ExtraContent;
|
|
115
|
+
/**
|
|
116
|
+
* Accented text color.
|
|
117
|
+
*/
|
|
118
|
+
priority?: Priority;
|
|
119
|
+
/**
|
|
120
|
+
* Whether to show the details in an overlay when the item is hovered / focused.
|
|
121
|
+
*/
|
|
122
|
+
showDetailsInOverlay?: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Determines the item's font sizes and internal paddings.
|
|
125
|
+
*/
|
|
126
|
+
size?: FormSize;
|
|
127
|
+
/**
|
|
128
|
+
* Optional tooltip that appears when the use hovers over the item. This is
|
|
129
|
+
* not very visible - if possible, add additional text via the `details`
|
|
130
|
+
* prop instead.
|
|
131
|
+
*/
|
|
132
|
+
tooltip?: ExtraContent;
|
|
133
|
+
/**
|
|
134
|
+
* Additional props to be passed into <Tooltip />.
|
|
135
|
+
*/
|
|
136
|
+
tooltipOptions?: Omit<TooltipProps, 'children' | 'title' | 'className'>;
|
|
137
|
+
/**
|
|
138
|
+
* Items to be added to the right of the label.
|
|
139
|
+
*/
|
|
140
|
+
trailingItems?: ExtraContent;
|
|
141
|
+
};
|
|
142
|
+
interface OtherProps<T extends React.ElementType> {
|
|
143
|
+
as?: T;
|
|
144
|
+
detailsProps?: Partial<React.ComponentProps<typeof StyledDetails>>;
|
|
145
|
+
innerWrapProps?: Partial<React.ComponentProps<typeof StyledInnerWrap>>;
|
|
146
|
+
isFocused?: boolean;
|
|
147
|
+
isPressed?: boolean;
|
|
148
|
+
isSelected?: boolean;
|
|
149
|
+
labelProps?: {
|
|
150
|
+
as?: 'div' | 'p';
|
|
151
|
+
id?: string;
|
|
152
|
+
};
|
|
153
|
+
onDetailsHoverChange?: (isHovered: boolean, event: React.PointerEvent) => void;
|
|
154
|
+
trailingAction?: MenuItemTrailingAction;
|
|
155
|
+
/** Ref to the trailing action's button. */
|
|
156
|
+
trailingActionRef?: React.Ref<HTMLButtonElement>;
|
|
157
|
+
/** Props for the wrapper around the trailing action. */
|
|
158
|
+
trailingActionWrapperProps?: React.ComponentPropsWithRef<'div'>;
|
|
159
|
+
}
|
|
160
|
+
interface MenuListItemProps<T extends React.ElementType = 'li'> extends ListItemProps, OtherProps<T> {
|
|
161
|
+
ref?: React.ComponentPropsWithRef<NoInfer<T>>['ref'];
|
|
162
|
+
}
|
|
163
|
+
/** Renders the shared visual shell for menu and select items. */
|
|
164
|
+
export declare function MenuListItem<T extends React.ElementType = 'li'>({ label, details, as, priority, size, disabled, leadingItems, trailingItems, trailingAction, isFocused, isSelected, isPressed, innerWrapProps, labelProps, detailsProps, showDetailsInOverlay, onDetailsHoverChange, tooltip, tooltipOptions, ref, trailingActionRef, trailingActionWrapperProps, ...props }: MenuListItemProps<T>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
165
|
+
/** Moves focus into a menu item's overlay details, returning whether it could. */
|
|
166
|
+
export declare function focusMenuItemDetails(item: Element | null): boolean;
|
|
167
|
+
export {};
|