@sentry/scraps 0.4.0 → 0.6.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 +74 -8
- package/dist/alert/alert.js +0 -3
- package/dist/badge/badge.js +1 -2
- package/dist/badge/tag.js +4 -4
- package/dist/button/button.js +1 -0
- package/dist/button/index.d.ts +0 -1
- package/dist/button/index.js +0 -1
- package/dist/button/linkButton.js +1 -0
- package/dist/button/styles.js +157 -152
- 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 +243 -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 +355 -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 +264 -0
- package/dist/confirm/index.d.ts +153 -0
- package/dist/confirm/index.js +132 -0
- package/dist/dateTime/config.d.ts +23 -0
- package/dist/dateTime/config.js +50 -0
- package/dist/dateTime/context.d.ts +18 -0
- package/dist/dateTime/context.js +46 -0
- package/dist/dateTime/dateTime.d.ts +6 -0
- package/dist/dateTime/dateTime.js +30 -0
- package/dist/dateTime/format.d.ts +24 -0
- package/dist/dateTime/format.js +45 -0
- package/dist/dateTime/index.d.ts +6 -0
- package/dist/dateTime/index.js +6 -0
- package/dist/dateTime/intlFormatter.d.ts +9 -0
- package/dist/dateTime/intlFormatter.js +16 -0
- package/dist/dateTime/parseDate.d.ts +3 -0
- package/dist/dateTime/parseDate.js +12 -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 +39 -0
- package/dist/dropdownMenu/context.js +3 -0
- package/dist/dropdownMenu/dropdownMenu.d.ts +70 -0
- package/dist/dropdownMenu/dropdownMenu.js +109 -0
- package/dist/dropdownMenu/index.d.ts +2 -0
- package/dist/dropdownMenu/index.js +1 -0
- package/dist/dropdownMenu/item.d.ts +140 -0
- package/dist/dropdownMenu/item.js +142 -0
- package/dist/dropdownMenu/list.d.ts +85 -0
- package/dist/dropdownMenu/list.js +429 -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 +24 -0
- package/dist/dropdownMenu/useDropdownMenuKeyboard.js +31 -0
- package/dist/dropdownMenu/useDropdownMenuRowLayout.d.ts +29 -0
- package/dist/dropdownMenu/useDropdownMenuRowLayout.js +64 -0
- package/dist/dropdownMenu/useDropdownRootMenuState.d.ts +13 -0
- package/dist/dropdownMenu/useDropdownRootMenuState.js +30 -0
- package/dist/dropdownMenu/useDropdownSubmenuState.d.ts +19 -0
- package/dist/dropdownMenu/useDropdownSubmenuState.js +25 -0
- package/dist/dropdownMenu/utils.d.ts +21 -0
- package/dist/dropdownMenu/utils.js +55 -0
- package/dist/duration/formatElapsedDuration.d.ts +4 -0
- package/dist/duration/formatElapsedDuration.js +10 -0
- package/dist/duration/getDuration.d.ts +68 -0
- package/dist/duration/getDuration.js +80 -0
- package/dist/duration/index.d.ts +2 -0
- package/dist/duration/index.js +2 -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/fzf.d.ts +9 -0
- package/dist/fzf.js +155 -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/container.d.ts +8 -2
- package/dist/layout/container.js +2 -2
- package/dist/layout/index.d.ts +2 -2
- package/dist/layout/index.js +1 -1
- package/dist/layout/styles.d.ts +2 -1
- package/dist/layout/styles.js +11 -5
- package/dist/legacyDatetime.d.ts +21 -0
- package/dist/legacyDatetime.js +13 -0
- package/dist/link/index.d.ts +1 -1
- package/dist/link/index.js +1 -1
- package/dist/link/link.js +4 -3
- package/dist/link/linkBehaviorContext.d.ts +11 -0
- package/dist/link/linkBehaviorContext.js +48 -11
- package/dist/menu/index.d.ts +1 -1
- package/dist/menu/index.js +1 -1
- package/dist/menu/menu.d.ts +14 -8
- package/dist/menu/menu.js +163 -60
- 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/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/relativeTime/getRelativeDate.d.ts +14 -0
- package/dist/relativeTime/getRelativeDate.js +107 -0
- package/dist/relativeTime/index.d.ts +3 -0
- package/dist/relativeTime/index.js +3 -0
- package/dist/relativeTime/relativeTime.d.ts +55 -0
- package/dist/relativeTime/relativeTime.js +102 -0
- package/dist/relativeTime/useRelativeTimeFormatter.d.ts +2 -0
- package/dist/relativeTime/useRelativeTimeFormatter.js +10 -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/splitPanel/splitPanel.d.ts +3 -1
- package/dist/splitPanel/splitPanel.js +2 -1
- 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/context.d.ts +9 -0
- package/dist/tabs/context.js +9 -0
- package/dist/tabs/index.d.ts +2 -0
- package/dist/tabs/index.js +1 -0
- package/dist/tabs/item.d.ts +24 -0
- package/dist/tabs/item.js +4 -0
- package/dist/tabs/tab.d.ts +22 -0
- package/dist/tabs/tab.js +208 -0
- package/dist/tabs/tabList.d.ts +18 -0
- package/dist/tabs/tabList.js +258 -0
- package/dist/tabs/tabPanels.d.ts +13 -0
- package/dist/tabs/tabPanels.js +62 -0
- package/dist/tabs/tabs.d.ts +53 -0
- package/dist/tabs/tabs.js +59 -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/prose.d.ts +2 -2
- 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/theme/theme.d.ts +34 -34
- package/dist/theme/theme.js +9 -0
- package/dist/theme/types.d.ts +20 -2
- package/dist/tooltip/tooltip.js +2 -5
- package/dist/translation/index.d.ts +1 -0
- package/dist/translation/index.js +1 -0
- package/dist/translation/translate.d.ts +9 -0
- package/dist/translation/translate.js +5 -0
- package/dist/translation/translationContext.d.ts +2 -1
- package/dist/translation/translationContext.js +2 -1
- 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/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/fonts/OFL.txt +94 -0
- package/fonts/roboto-mono-variable-cyrillic-ext.woff2 +0 -0
- package/fonts/roboto-mono-variable-cyrillic.woff2 +0 -0
- package/fonts/roboto-mono-variable-greek.woff2 +0 -0
- package/fonts/roboto-mono-variable-latin-ext.woff2 +0 -0
- package/fonts/roboto-mono-variable-vietnamese.woff2 +0 -0
- package/fonts/roboto-mono-variable.woff2 +0 -0
- package/fonts/rubik-variable-cyrillic-ext.woff2 +0 -0
- package/fonts/rubik-variable-cyrillic.woff2 +0 -0
- package/fonts/rubik-variable-latin-ext.woff2 +0 -0
- package/fonts/rubik-variable.woff2 +0 -0
- package/fonts.css +211 -0
- package/package.json +140 -23
- package/dist/datetime.d.ts +0 -39
- package/dist/datetime.js +0 -20
- 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,101 @@
|
|
|
1
|
+
import { jsx, jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { Fragment, createContext, useContext, useMemo, useRef } from "react";
|
|
3
|
+
import { useOption } from "@react-aria/listbox";
|
|
4
|
+
import { mergeRefs } from "@react-aria/utils";
|
|
5
|
+
import { IconCheckmark } from "@sentry/icons/checkmark";
|
|
6
|
+
import { Checkbox } from "../../checkbox/index.js";
|
|
7
|
+
import { HighlightText } from "../highlightText.js";
|
|
8
|
+
import { LeadWrap, getOptionPaddingLeft } from "../styles.js";
|
|
9
|
+
import { ControlContext, ListItem, useReserveLeadingSlot } from "../../menu/index.js";
|
|
10
|
+
const ListBoxDetailsHoverContext = /*#__PURE__*/ createContext(void 0);
|
|
11
|
+
function ListBoxOption({ item, listState, size, showDetails = true, ref: refProp, 'data-index': dataIndex }) {
|
|
12
|
+
const ref = useRef(null);
|
|
13
|
+
const { label, details, trailingItems, priority, hideCheck, tooltip, tooltipOptions, selectionMode, showDetailsInOverlay } = item.props;
|
|
14
|
+
const multiple = selectionMode ? 'multiple' === selectionMode : 'multiple' === listState.selectionManager.selectionMode;
|
|
15
|
+
const { optionProps, labelProps, isSelected, isFocused, isDisabled, isPressed } = useOption({
|
|
16
|
+
key: item.key,
|
|
17
|
+
'aria-label': item['aria-label']
|
|
18
|
+
}, listState, ref);
|
|
19
|
+
const { search, highlightSearch } = useContext(ControlContext);
|
|
20
|
+
const onDetailsHoverChange = useContext(ListBoxDetailsHoverContext);
|
|
21
|
+
const renderedLabel = highlightSearch && search && 'string' == typeof label ? /*#__PURE__*/ jsx(HighlightText, {
|
|
22
|
+
text: label,
|
|
23
|
+
query: search
|
|
24
|
+
}) : label;
|
|
25
|
+
const labelPropsMemo = useMemo(()=>({
|
|
26
|
+
...labelProps,
|
|
27
|
+
as: 'string' == typeof label ? 'p' : 'div'
|
|
28
|
+
}), [
|
|
29
|
+
labelProps.id,
|
|
30
|
+
label
|
|
31
|
+
]);
|
|
32
|
+
const reserveLeadingSlot = useReserveLeadingSlot();
|
|
33
|
+
const { leadingItems } = item.props;
|
|
34
|
+
const leadingItemsMemo = useMemo(()=>{
|
|
35
|
+
const checkboxSize = 'xs' === size ? 'xs' : 'sm';
|
|
36
|
+
const leading = 'function' == typeof leadingItems ? leadingItems({
|
|
37
|
+
disabled: isDisabled,
|
|
38
|
+
isFocused,
|
|
39
|
+
isSelected
|
|
40
|
+
}) : leadingItems;
|
|
41
|
+
if (hideCheck) return leading;
|
|
42
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
43
|
+
children: [
|
|
44
|
+
/*#__PURE__*/ jsx(LeadWrap, {
|
|
45
|
+
"aria-hidden": "true",
|
|
46
|
+
children: multiple ? /*#__PURE__*/ jsx(Checkbox, {
|
|
47
|
+
size: checkboxSize,
|
|
48
|
+
checked: isSelected,
|
|
49
|
+
disabled: isDisabled,
|
|
50
|
+
readOnly: true
|
|
51
|
+
}) : isSelected && /*#__PURE__*/ jsx(IconCheckmark, {
|
|
52
|
+
size: checkboxSize,
|
|
53
|
+
variant: "accent"
|
|
54
|
+
})
|
|
55
|
+
}),
|
|
56
|
+
leading || reserveLeadingSlot ? /*#__PURE__*/ jsx(LeadWrap, {
|
|
57
|
+
"aria-hidden": "true",
|
|
58
|
+
minWidth: reserveLeadingSlot ? '16px' : void 0,
|
|
59
|
+
children: leading
|
|
60
|
+
}) : null
|
|
61
|
+
]
|
|
62
|
+
});
|
|
63
|
+
}, [
|
|
64
|
+
size,
|
|
65
|
+
leadingItems,
|
|
66
|
+
isDisabled,
|
|
67
|
+
isFocused,
|
|
68
|
+
isSelected,
|
|
69
|
+
hideCheck,
|
|
70
|
+
multiple,
|
|
71
|
+
reserveLeadingSlot
|
|
72
|
+
]);
|
|
73
|
+
return /*#__PURE__*/ jsx(ListItem, {
|
|
74
|
+
...optionProps,
|
|
75
|
+
"data-index": dataIndex,
|
|
76
|
+
ref: mergeRefs(ref, refProp),
|
|
77
|
+
size: size,
|
|
78
|
+
label: renderedLabel,
|
|
79
|
+
details: showDetails ? details : null,
|
|
80
|
+
disabled: isDisabled,
|
|
81
|
+
isPressed: isPressed,
|
|
82
|
+
isSelected: isSelected,
|
|
83
|
+
isFocused: listState.selectionManager.isFocused && isFocused,
|
|
84
|
+
priority: priority ? 'primary' : 'default',
|
|
85
|
+
labelProps: labelPropsMemo,
|
|
86
|
+
leadingItems: leadingItemsMemo,
|
|
87
|
+
innerWrapProps: {
|
|
88
|
+
paddingLeft: getOptionPaddingLeft({
|
|
89
|
+
hasCheck: !hideCheck,
|
|
90
|
+
hasLeadingItems: Boolean(leadingItems) || reserveLeadingSlot
|
|
91
|
+
})
|
|
92
|
+
},
|
|
93
|
+
trailingItems: trailingItems,
|
|
94
|
+
showDetailsInOverlay: showDetailsInOverlay,
|
|
95
|
+
onDetailsHoverChange: onDetailsHoverChange,
|
|
96
|
+
tooltip: tooltip,
|
|
97
|
+
tooltipOptions: tooltipOptions,
|
|
98
|
+
"data-test-id": item.key
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
export { ListBoxDetailsHoverContext, ListBoxOption };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import type { ListState } from '@react-stately/list';
|
|
3
|
+
import type { Node } from '@react-types/shared';
|
|
4
|
+
import type { SelectKey, ListItemBase } from '../types.js';
|
|
5
|
+
import { type ListBoxOptionProps } from './option.js';
|
|
6
|
+
interface ListBoxSectionProps<T extends ListItemBase> {
|
|
7
|
+
hiddenOptions: Set<SelectKey>;
|
|
8
|
+
item: Node<T>;
|
|
9
|
+
listState: ListState<T>;
|
|
10
|
+
showSectionHeaders: boolean;
|
|
11
|
+
size: ListBoxOptionProps['size'];
|
|
12
|
+
'data-index'?: number;
|
|
13
|
+
ref?: React.Ref<HTMLLIElement>;
|
|
14
|
+
showDetails?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A <li /> element that functions as a list box section (renders a nested <ul />
|
|
18
|
+
* inside). https://react-spectrum.adobe.com/react-aria/useListBox.html
|
|
19
|
+
*/
|
|
20
|
+
export declare function ListBoxSection<T extends ListItemBase>({ item, listState, size, hiddenOptions, showSectionHeaders, showDetails, ref, 'data-index': dataIndex, }: ListBoxSectionProps<T>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsx, jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { Fragment, useMemo } from "react";
|
|
3
|
+
import { useListBoxSection } from "@react-aria/listbox";
|
|
4
|
+
import { useSeparator } from "@react-aria/separator";
|
|
5
|
+
import { SectionSeparator } from "../styles.js";
|
|
6
|
+
import { SectionToggle } from "../utils.js";
|
|
7
|
+
import { SectionGroup, SectionHeader, SectionLabel, SectionList } from "../../menu/index.js";
|
|
8
|
+
import { ListBoxOption } from "./option.js";
|
|
9
|
+
function ListBoxSection({ item, listState, size, hiddenOptions, showSectionHeaders, showDetails = true, ref, 'data-index': dataIndex }) {
|
|
10
|
+
const { itemProps, headingProps, groupProps } = useListBoxSection({
|
|
11
|
+
heading: item.rendered,
|
|
12
|
+
'aria-label': item['aria-label']
|
|
13
|
+
});
|
|
14
|
+
const { separatorProps } = useSeparator({
|
|
15
|
+
elementType: 'li'
|
|
16
|
+
});
|
|
17
|
+
const showToggleAllButton = 'multiple' === listState.selectionManager.selectionMode && item.value?.showToggleAllButton;
|
|
18
|
+
const childItems = useMemo(()=>[
|
|
19
|
+
...item.childNodes
|
|
20
|
+
].filter((child)=>!hiddenOptions.has(child.key)), [
|
|
21
|
+
item.childNodes,
|
|
22
|
+
hiddenOptions
|
|
23
|
+
]);
|
|
24
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
25
|
+
children: [
|
|
26
|
+
showSectionHeaders && /*#__PURE__*/ jsx(SectionSeparator, {
|
|
27
|
+
...separatorProps
|
|
28
|
+
}),
|
|
29
|
+
/*#__PURE__*/ jsxs(SectionGroup, {
|
|
30
|
+
...itemProps,
|
|
31
|
+
"data-index": dataIndex,
|
|
32
|
+
ref: ref,
|
|
33
|
+
children: [
|
|
34
|
+
(item.rendered || showToggleAllButton) && showSectionHeaders && /*#__PURE__*/ jsx(SectionHeader, {
|
|
35
|
+
trailingAction: showToggleAllButton ? /*#__PURE__*/ jsx(SectionToggle, {
|
|
36
|
+
item: item,
|
|
37
|
+
listState: listState
|
|
38
|
+
}) : null,
|
|
39
|
+
children: item.rendered && /*#__PURE__*/ jsx(SectionLabel, {
|
|
40
|
+
...headingProps,
|
|
41
|
+
children: item.rendered
|
|
42
|
+
})
|
|
43
|
+
}),
|
|
44
|
+
/*#__PURE__*/ jsx(SectionList, {
|
|
45
|
+
...groupProps,
|
|
46
|
+
children: childItems.map((child)=>/*#__PURE__*/ jsx(ListBoxOption, {
|
|
47
|
+
item: child,
|
|
48
|
+
listState: listState,
|
|
49
|
+
size: size,
|
|
50
|
+
showDetails: showDetails
|
|
51
|
+
}, child.key))
|
|
52
|
+
})
|
|
53
|
+
]
|
|
54
|
+
})
|
|
55
|
+
]
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
export { ListBoxSection };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { DistributedOmit } from 'type-fest';
|
|
2
|
+
import { type AlertProps } from '../alert/index.js';
|
|
3
|
+
import { type ButtonProps, type LinkButtonProps } from '../button/index.js';
|
|
4
|
+
import { type CheckboxProps } from '../checkbox/index.js';
|
|
5
|
+
export declare const MenuComponents: {
|
|
6
|
+
/**
|
|
7
|
+
* A button sized and styled to sit in `menuHeaderTrailingItems`. Inherits the
|
|
8
|
+
* header's font size and renders in secondary text color so it blends with the
|
|
9
|
+
* title rather than competing with it.
|
|
10
|
+
*
|
|
11
|
+
* Use this for lightweight, immediate actions in the header — e.g. "Reset",
|
|
12
|
+
* "Clear", "Invite Member", or "Sync". These actions typically take effect
|
|
13
|
+
* immediately and close the menu. For navigation actions use `LinkButton`
|
|
14
|
+
* instead. For prominent footer actions use `CTAButton`.
|
|
15
|
+
*/
|
|
16
|
+
HeaderButton(props: DistributedOmit<ButtonProps, "variant" | "size">): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
17
|
+
/**
|
|
18
|
+
* A button sized and styled to sit in `menuHeaderTrailingItems`. Inherits the
|
|
19
|
+
* header's font size and renders in secondary text color so it blends with the
|
|
20
|
+
* title rather than competing with it.
|
|
21
|
+
*
|
|
22
|
+
* Use this for lightweight, immediate actions in the header — e.g. "Reset",
|
|
23
|
+
* "Clear", "Invite Member", or "Sync". These actions typically take effect
|
|
24
|
+
* immediately and close the menu. For navigation actions use `LinkButton`
|
|
25
|
+
* instead. For prominent footer actions use `CTAButton`.
|
|
26
|
+
*
|
|
27
|
+
* `priority` and `size` are locked to keep the header visually consistent.
|
|
28
|
+
*/
|
|
29
|
+
ResetButton(props: DistributedOmit<ButtonProps, "variant" | "size" | "children">): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
30
|
+
ClearButton(props: DistributedOmit<ButtonProps, "variant" | "size" | "children">): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
31
|
+
/**
|
|
32
|
+
* A button sized for `menuFooter` call-to-action slots. Larger and more
|
|
33
|
+
* visually prominent than `HeaderButton`, making it suitable for primary footer
|
|
34
|
+
* actions that don't navigate — e.g. "Invite Member" or "Create".
|
|
35
|
+
*
|
|
36
|
+
* Use this in `menuFooter` for standalone actions that aren't part of a staged
|
|
37
|
+
* selection workflow. For staged selection (deferred apply/cancel) use
|
|
38
|
+
* `ApplyButton` and `CancelButton` instead. For navigation actions use
|
|
39
|
+
* `CTALinkButton`.
|
|
40
|
+
*
|
|
41
|
+
* `priority` and `size` are locked to keep footer actions visually consistent.
|
|
42
|
+
*/
|
|
43
|
+
CTAButton(props: DistributedOmit<ButtonProps, "variant" | "size">): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
44
|
+
CTALinkButton(props: DistributedOmit<LinkButtonProps, "variant" | "size">): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
45
|
+
/**
|
|
46
|
+
* A primary "Apply" button for use in `menuFooter` in staged selection
|
|
47
|
+
* workflows, where changes are held locally and only committed when the user
|
|
48
|
+
* explicitly confirms. Automatically closes the menu after the `onClick`
|
|
49
|
+
* handler runs.
|
|
50
|
+
*
|
|
51
|
+
* Always pair with `CancelButton`. The typical pattern is:
|
|
52
|
+
*
|
|
53
|
+
* ```tsx
|
|
54
|
+
* menuFooter={
|
|
55
|
+
* stagedSelect.hasStagedChanges ? (
|
|
56
|
+
* <Flex gap="md" justify="end">
|
|
57
|
+
* <MenuComponents.CancelButton onClick={() => stagedSelect.removeStagedChanges()} />
|
|
58
|
+
* <MenuComponents.ApplyButton onClick={() => stagedSelect.commit(stagedSelect.stagedValue)} />
|
|
59
|
+
* </Flex>
|
|
60
|
+
* ) : null
|
|
61
|
+
* }
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* `priority` (`primary`) and `size` are locked to keep staged selection UIs consistent.
|
|
65
|
+
*/
|
|
66
|
+
ApplyButton(props: DistributedOmit<ButtonProps, "variant" | "size" | "children">): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
67
|
+
/**
|
|
68
|
+
* A "Cancel" button for use in `menuFooter` in staged selection workflows,
|
|
69
|
+
* where changes are held locally and discarded when the user cancels.
|
|
70
|
+
* Automatically closes the menu after the `onClick` handler runs.
|
|
71
|
+
*
|
|
72
|
+
* Always pair with `ApplyButton`. See `ApplyButton` for the full usage pattern.
|
|
73
|
+
*
|
|
74
|
+
* `priority` and `size` are locked to keep staged selection UIs consistent.
|
|
75
|
+
*/
|
|
76
|
+
CancelButton(props: DistributedOmit<ButtonProps, "variant" | "size" | "children">): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
77
|
+
/**
|
|
78
|
+
* A condensed alert for use in `menuFooter` to surface contextual warnings or
|
|
79
|
+
* information without leaving the menu — e.g. "You've reached the selection
|
|
80
|
+
* limit" or "Some items are unavailable".
|
|
81
|
+
*
|
|
82
|
+
* Accepts all Alert `variant` values (`warning`, `info`, `error`, `success`).
|
|
83
|
+
* `system` is locked to `false` to prevent the full-bleed layout from
|
|
84
|
+
* breaking the menu's padding, and `showIcon` is locked to `false` to keep
|
|
85
|
+
* the alert compact.
|
|
86
|
+
*/
|
|
87
|
+
Alert({ children, ...props }: DistributedOmit<AlertProps, "system" | "showIcon">): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
88
|
+
Checkbox(props: DistributedOmit<CheckboxProps, "size">): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
89
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { useContext } from "react";
|
|
3
|
+
import styled from "@emotion/styled";
|
|
4
|
+
import { Alert } from "../alert/index.js";
|
|
5
|
+
import { Button, LinkButton } from "../button/index.js";
|
|
6
|
+
import { Checkbox } from "../checkbox/index.js";
|
|
7
|
+
import { ControlContext } from "../menu/index.js";
|
|
8
|
+
import { Text } from "../text/index.js";
|
|
9
|
+
import { useTranslation } from "../translation/index.js";
|
|
10
|
+
const MenuComponents = {
|
|
11
|
+
HeaderButton (props) {
|
|
12
|
+
return /*#__PURE__*/ jsx(StyledHeaderButton, {
|
|
13
|
+
size: "zero",
|
|
14
|
+
variant: "transparent",
|
|
15
|
+
...props
|
|
16
|
+
});
|
|
17
|
+
},
|
|
18
|
+
ResetButton (props) {
|
|
19
|
+
const controlContext = useContext(ControlContext);
|
|
20
|
+
const { t } = useTranslation();
|
|
21
|
+
return /*#__PURE__*/ jsx(StyledHeaderButton, {
|
|
22
|
+
size: "zero",
|
|
23
|
+
variant: "transparent",
|
|
24
|
+
...props,
|
|
25
|
+
onClick: (e)=>{
|
|
26
|
+
props.onClick?.(e);
|
|
27
|
+
controlContext.overlayState?.close();
|
|
28
|
+
},
|
|
29
|
+
children: t('Reset')
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
ClearButton (props) {
|
|
33
|
+
const controlContext = useContext(ControlContext);
|
|
34
|
+
const { t } = useTranslation();
|
|
35
|
+
return /*#__PURE__*/ jsx(StyledHeaderButton, {
|
|
36
|
+
size: "zero",
|
|
37
|
+
variant: "transparent",
|
|
38
|
+
...props,
|
|
39
|
+
onClick: (e)=>{
|
|
40
|
+
props.onClick?.(e);
|
|
41
|
+
controlContext.overlayState?.close();
|
|
42
|
+
},
|
|
43
|
+
children: t('Clear')
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
CTAButton (props) {
|
|
47
|
+
return /*#__PURE__*/ jsx(Button, {
|
|
48
|
+
size: "xs",
|
|
49
|
+
variant: "secondary",
|
|
50
|
+
...props
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
CTALinkButton (props) {
|
|
54
|
+
return /*#__PURE__*/ jsx(LinkButton, {
|
|
55
|
+
size: "xs",
|
|
56
|
+
variant: "secondary",
|
|
57
|
+
...props
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
ApplyButton (props) {
|
|
61
|
+
const controlContext = useContext(ControlContext);
|
|
62
|
+
const { t } = useTranslation();
|
|
63
|
+
return /*#__PURE__*/ jsx(Button, {
|
|
64
|
+
size: "xs",
|
|
65
|
+
variant: "primary",
|
|
66
|
+
...props,
|
|
67
|
+
onClick: (e)=>{
|
|
68
|
+
props.onClick?.(e);
|
|
69
|
+
controlContext.overlayState?.close();
|
|
70
|
+
},
|
|
71
|
+
children: t('Apply')
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
CancelButton (props) {
|
|
75
|
+
const controlContext = useContext(ControlContext);
|
|
76
|
+
const { t } = useTranslation();
|
|
77
|
+
return /*#__PURE__*/ jsx(Button, {
|
|
78
|
+
size: "xs",
|
|
79
|
+
variant: "transparent",
|
|
80
|
+
...props,
|
|
81
|
+
onClick: (e)=>{
|
|
82
|
+
props.onClick?.(e);
|
|
83
|
+
controlContext.overlayState?.close();
|
|
84
|
+
},
|
|
85
|
+
children: t('Cancel')
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
Alert ({ children, ...props }) {
|
|
89
|
+
return /*#__PURE__*/ jsx(StyledAlert, {
|
|
90
|
+
...props,
|
|
91
|
+
system: false,
|
|
92
|
+
showIcon: false,
|
|
93
|
+
children: /*#__PURE__*/ jsx(Text, {
|
|
94
|
+
size: "sm",
|
|
95
|
+
children: children
|
|
96
|
+
})
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
Checkbox (props) {
|
|
100
|
+
return /*#__PURE__*/ jsx(Checkbox, {
|
|
101
|
+
size: "sm",
|
|
102
|
+
...props
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
const StyledAlert = styled(Alert)`
|
|
107
|
+
padding: ${(p)=>p.theme.space.xs} ${(p)=>p.theme.space.lg};
|
|
108
|
+
text-wrap: balance;
|
|
109
|
+
`;
|
|
110
|
+
const StyledHeaderButton = styled(Button)`
|
|
111
|
+
font-size: inherit; /* Inherit font size from MenuHeader */
|
|
112
|
+
font-weight: ${(p)=>p.theme.font.weight.sans.regular};
|
|
113
|
+
color: ${(p)=>p.theme.tokens.content.secondary};
|
|
114
|
+
padding: 0 ${(p)=>p.theme.space.xs};
|
|
115
|
+
margin: -${(p)=>p.theme.space.sm} -${(p)=>p.theme.space.xs};
|
|
116
|
+
`;
|
|
117
|
+
export { MenuComponents };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import { type FlexProps } from '../layout/index.js';
|
|
3
|
+
export declare const ListWrap: import("@emotion/styled").StyledComponent<{
|
|
4
|
+
theme?: import("@emotion/react").Theme;
|
|
5
|
+
as?: React.ElementType;
|
|
6
|
+
}, React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, {}>;
|
|
7
|
+
export declare const ListLabel: import("@emotion/styled").StyledComponent<{
|
|
8
|
+
theme?: import("@emotion/react").Theme;
|
|
9
|
+
as?: React.ElementType;
|
|
10
|
+
}, React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
11
|
+
export declare const ListSeparator: import("@emotion/styled").StyledComponent<{
|
|
12
|
+
theme?: import("@emotion/react").Theme;
|
|
13
|
+
as?: React.ElementType;
|
|
14
|
+
}, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
15
|
+
export declare const SectionToggleButton: import("@emotion/styled").StyledComponent<(import("../button/index.js").ButtonProps & {
|
|
16
|
+
theme?: import("@emotion/react").Theme;
|
|
17
|
+
}) & {
|
|
18
|
+
visible: boolean;
|
|
19
|
+
}, {}, {}>;
|
|
20
|
+
export declare function SectionSeparator(props: React.HTMLAttributes<HTMLLIElement>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
21
|
+
/**
|
|
22
|
+
* Left inset for CompactSelect options. CompactSelect puts its check column 4px
|
|
23
|
+
* closer to the menu edge than dropdown menus, in line with the title. The shared
|
|
24
|
+
* menu item centers leading content in a 24px slot, which already adds 4px
|
|
25
|
+
* before a 16px checkbox, so a single check-sized item needs a smaller inset.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getOptionPaddingLeft({ hasCheck, hasLeadingItems, }: {
|
|
28
|
+
hasCheck: boolean;
|
|
29
|
+
hasLeadingItems: boolean;
|
|
30
|
+
}): "xs" | "md";
|
|
31
|
+
export declare function LeadWrap(props: FlexProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
32
|
+
export declare const EmptyMessage: import("@emotion/styled").StyledComponent<{
|
|
33
|
+
theme?: import("@emotion/react").Theme;
|
|
34
|
+
as?: React.ElementType;
|
|
35
|
+
}, React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, {}>;
|
|
36
|
+
export declare const SizeLimitMessage: import("@emotion/styled").StyledComponent<{
|
|
37
|
+
theme?: import("@emotion/react").Theme;
|
|
38
|
+
as?: React.ElementType;
|
|
39
|
+
}, React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, {}>;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { css } from "@emotion/react";
|
|
3
|
+
import styled from "@emotion/styled";
|
|
4
|
+
import { Button } from "../button/index.js";
|
|
5
|
+
import { Flex, Stack } from "../layout/index.js";
|
|
6
|
+
import { SectionSeparator } from "../menu/index.js";
|
|
7
|
+
const ListWrap = styled('ul')`
|
|
8
|
+
margin: 0;
|
|
9
|
+
padding: ${(p)=>p.theme.space.xs} 0;
|
|
10
|
+
|
|
11
|
+
> [data-section-separator]:first-of-type {
|
|
12
|
+
display: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/* Add 1px to top padding if preceded by menu header, to account for the header's
|
|
16
|
+
shadow border */
|
|
17
|
+
[data-menu-has-header='true'] > div > &:first-of-type {
|
|
18
|
+
padding-top: calc(${(p)=>p.theme.space.xs} + 1px);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* Add 1px to bottom padding if succeeded by menu footer, to account for the footer's
|
|
22
|
+
shadow border */
|
|
23
|
+
[data-menu-has-footer='true'] > div > &:last-of-type {
|
|
24
|
+
padding-bottom: calc(${(p)=>p.theme.space.xs} + 1px);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* Remove top padding if preceded by search input, since search input already has
|
|
28
|
+
vertical padding. Account for InputGroup wrapper div. */
|
|
29
|
+
div:has(input) ~ &&:first-of-type,
|
|
30
|
+
div:has(input) ~ div > &&:first-of-type {
|
|
31
|
+
padding-top: 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&:empty {
|
|
35
|
+
padding: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* Should scroll if it's in a non-composite select */
|
|
39
|
+
:only-of-type {
|
|
40
|
+
min-height: 0;
|
|
41
|
+
overflow: auto;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
:focus-visible {
|
|
45
|
+
outline: none;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* The first section follows a hidden separator in a headerless menu. */
|
|
49
|
+
[data-menu-has-header='false']
|
|
50
|
+
&:first-of-type
|
|
51
|
+
li[role='presentation']:nth-of-type(2)
|
|
52
|
+
> [data-section-header] {
|
|
53
|
+
padding-top: 0;
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
56
|
+
const ListLabel = styled('span')`
|
|
57
|
+
display: inline-block;
|
|
58
|
+
font-weight: ${(p)=>p.theme.font.weight.sans.medium};
|
|
59
|
+
font-size: ${(p)=>p.theme.font.size.xs};
|
|
60
|
+
color: ${(p)=>p.theme.tokens.content.secondary};
|
|
61
|
+
text-transform: uppercase;
|
|
62
|
+
white-space: nowrap;
|
|
63
|
+
margin: ${(p)=>p.theme.space.xs} ${(p)=>p.theme.space.lg};
|
|
64
|
+
padding-right: ${(p)=>p.theme.space.md};
|
|
65
|
+
`;
|
|
66
|
+
const ListSeparator = styled('div')`
|
|
67
|
+
border-top: solid 1px ${(p)=>p.theme.tokens.border.secondary};
|
|
68
|
+
margin: ${(p)=>p.theme.space.xs} ${(p)=>p.theme.space.lg};
|
|
69
|
+
|
|
70
|
+
:first-child {
|
|
71
|
+
display: none;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
ul:empty + & {
|
|
75
|
+
display: none;
|
|
76
|
+
}
|
|
77
|
+
`;
|
|
78
|
+
const SectionToggleButton = styled(Button)`
|
|
79
|
+
padding: 0 ${(p)=>p.theme.space.xs};
|
|
80
|
+
margin: 0 -${(p)=>p.theme.space.xs} 0 ${(p)=>p.theme.space.xl};
|
|
81
|
+
font-weight: ${(p)=>p.theme.font.weight.sans.regular};
|
|
82
|
+
font-size: ${(p)=>p.theme.font.size.sm};
|
|
83
|
+
color: ${(p)=>p.theme.tokens.content.secondary};
|
|
84
|
+
transition: opacity 0.1s;
|
|
85
|
+
|
|
86
|
+
&:focus-visible {
|
|
87
|
+
opacity: 1;
|
|
88
|
+
pointer-events: all;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
${(p)=>p.visible ? css`
|
|
92
|
+
opacity: 1;
|
|
93
|
+
pointer-events: all;
|
|
94
|
+
` : css`
|
|
95
|
+
opacity: 0;
|
|
96
|
+
pointer-events: none;
|
|
97
|
+
`}
|
|
98
|
+
|
|
99
|
+
li[role='rowgroup']:hover &,
|
|
100
|
+
li[role='presentation']:hover & {
|
|
101
|
+
opacity: 1;
|
|
102
|
+
pointer-events: all;
|
|
103
|
+
}
|
|
104
|
+
`;
|
|
105
|
+
function styles_SectionSeparator(props) {
|
|
106
|
+
return /*#__PURE__*/ jsx(Stack, {
|
|
107
|
+
as: "li",
|
|
108
|
+
"data-section-separator": true,
|
|
109
|
+
justify: "center",
|
|
110
|
+
height: "8px",
|
|
111
|
+
padding: "0 lg 0 xl",
|
|
112
|
+
...props,
|
|
113
|
+
role: "presentation",
|
|
114
|
+
children: /*#__PURE__*/ jsx(SectionSeparator, {})
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
function getOptionPaddingLeft({ hasCheck, hasLeadingItems }) {
|
|
118
|
+
if (hasCheck && hasLeadingItems) return 'md';
|
|
119
|
+
return hasCheck || hasLeadingItems ? 'xs' : 'md';
|
|
120
|
+
}
|
|
121
|
+
function LeadWrap(props) {
|
|
122
|
+
return /*#__PURE__*/ jsx(Flex, {
|
|
123
|
+
justify: "center",
|
|
124
|
+
align: "center",
|
|
125
|
+
minWidth: "1em",
|
|
126
|
+
height: "1rem",
|
|
127
|
+
pointerEvents: "none",
|
|
128
|
+
...props
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
const EmptyMessage = styled('p')`
|
|
132
|
+
text-align: center;
|
|
133
|
+
color: ${(p)=>p.theme.tokens.content.secondary};
|
|
134
|
+
padding: ${(p)=>p.theme.space.md} ${(p)=>p.theme.space.lg} ${(p)=>p.theme.space.lg};
|
|
135
|
+
margin: 0;
|
|
136
|
+
|
|
137
|
+
/* Message should only be displayed when _all_ preceding lists are empty */
|
|
138
|
+
display: block;
|
|
139
|
+
div:has(ul:not(:empty)) ~ &,
|
|
140
|
+
ul:not(:empty) ~ & {
|
|
141
|
+
display: none;
|
|
142
|
+
}
|
|
143
|
+
`;
|
|
144
|
+
const SizeLimitMessage = styled('li')`
|
|
145
|
+
border-top: solid 1px ${(p)=>p.theme.tokens.border.secondary};
|
|
146
|
+
margin: ${(p)=>p.theme.space.xs} ${(p)=>p.theme.space.lg} ${(p)=>p.theme.space.xs};
|
|
147
|
+
padding: ${(p)=>p.theme.space.sm} ${(p)=>p.theme.space.md} 0;
|
|
148
|
+
|
|
149
|
+
font-size: ${(p)=>p.theme.font.size.sm};
|
|
150
|
+
color: ${(p)=>p.theme.tokens.content.secondary};
|
|
151
|
+
list-style-type: none;
|
|
152
|
+
white-space: nowrap;
|
|
153
|
+
text-align: center;
|
|
154
|
+
`;
|
|
155
|
+
export { EmptyMessage, LeadWrap, ListLabel, ListSeparator, ListWrap, SectionToggleButton, SizeLimitMessage, getOptionPaddingLeft, styles_SectionSeparator as SectionSeparator };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { ListItemBase, SelectKey, SelectOption, SelectSection, SelectOptionOrSection, SearchMatchResult, SearchConfig, SelectOptionWithKey, SelectSectionWithKey, SelectOptionOrSectionWithKey, } from '../menu/index.js';
|
|
File without changes
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Node } from '@react-types/shared';
|
|
2
|
+
import type { FormSize } from '../theme/index.js';
|
|
3
|
+
type ObjectLike = object;
|
|
4
|
+
export declare function useVirtualizedItems<T extends ObjectLike>({ listItems, listPadding, virtualized, size, }: {
|
|
5
|
+
listItems: Array<Node<T>>;
|
|
6
|
+
size: FormSize;
|
|
7
|
+
virtualized: boolean | undefined;
|
|
8
|
+
listPadding?: number;
|
|
9
|
+
}): {
|
|
10
|
+
readonly items: import("@tanstack/react-virtual").VirtualItem[];
|
|
11
|
+
readonly scrollToIndex: (index: number) => void;
|
|
12
|
+
readonly scrollElementRef: import("react").RefObject<HTMLDivElement | null>;
|
|
13
|
+
readonly itemProps: (index: number) => {
|
|
14
|
+
ref: (node: Element | null) => void;
|
|
15
|
+
'data-index': number;
|
|
16
|
+
};
|
|
17
|
+
readonly wrapperProps: {
|
|
18
|
+
readonly 'data-is-virtualized': true;
|
|
19
|
+
readonly style: {
|
|
20
|
+
readonly height: number;
|
|
21
|
+
readonly width: "100%";
|
|
22
|
+
readonly position: "relative";
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
readonly listWrapStyle: {
|
|
26
|
+
readonly position: "absolute";
|
|
27
|
+
readonly top: 0;
|
|
28
|
+
readonly left: 0;
|
|
29
|
+
readonly width: "100%";
|
|
30
|
+
readonly transform: `translateY(${number}px)`;
|
|
31
|
+
};
|
|
32
|
+
} | {
|
|
33
|
+
readonly items: {
|
|
34
|
+
index: number;
|
|
35
|
+
start: number;
|
|
36
|
+
}[];
|
|
37
|
+
readonly scrollToIndex: () => void;
|
|
38
|
+
readonly scrollElementRef: undefined;
|
|
39
|
+
readonly itemProps: () => void;
|
|
40
|
+
readonly wrapperProps: {
|
|
41
|
+
readonly 'data-is-virtualized': false;
|
|
42
|
+
readonly style?: undefined;
|
|
43
|
+
};
|
|
44
|
+
readonly listWrapStyle: {
|
|
45
|
+
readonly position?: undefined;
|
|
46
|
+
readonly top?: undefined;
|
|
47
|
+
readonly left?: undefined;
|
|
48
|
+
readonly width?: undefined;
|
|
49
|
+
readonly transform?: undefined;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export {};
|