@sentry/scraps 0.4.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/link/link.js +4 -3
- package/dist/link/linkBehaviorContext.d.ts +2 -0
- package/dist/link/linkBehaviorContext.js +17 -10
- package/dist/menu/index.d.ts +1 -1
- package/dist/menu/index.js +1 -1
- package/dist/menu/menu.d.ts +14 -6
- package/dist/menu/menu.js +160 -56
- 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/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/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/tooltip/tooltip.js +2 -5
- 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/package.json +115 -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,133 @@
|
|
|
1
|
+
import { css } from "@emotion/react";
|
|
2
|
+
const generateThemePrismVariables = (theme, blockBackground)=>({
|
|
3
|
+
'--prism-base': theme.tokens.syntax.base,
|
|
4
|
+
'--prism-inline-code': theme.tokens.syntax.inlineCode,
|
|
5
|
+
'--prism-inline-code-background': theme.tokens.syntax.codeBackground,
|
|
6
|
+
'--prism-highlight-background': theme.tokens.syntax.hightlightBackground,
|
|
7
|
+
'--prism-highlight-accent': theme.tokens.syntax.hightlightAccent,
|
|
8
|
+
'--prism-comment': theme.tokens.syntax.comment,
|
|
9
|
+
'--prism-punctuation': theme.tokens.syntax.punctuation,
|
|
10
|
+
'--prism-property': theme.tokens.syntax.property,
|
|
11
|
+
'--prism-selector': theme.tokens.syntax.selector,
|
|
12
|
+
'--prism-operator': theme.tokens.syntax.operator,
|
|
13
|
+
'--prism-variable': theme.tokens.syntax.variable,
|
|
14
|
+
'--prism-function': theme.tokens.syntax.function,
|
|
15
|
+
'--prism-keyword': theme.tokens.syntax.keyWord,
|
|
16
|
+
'--prism-block-background': blockBackground
|
|
17
|
+
});
|
|
18
|
+
const codeBlockStyles = (theme)=>css`
|
|
19
|
+
${generateThemePrismVariables(theme, theme.tokens.background.secondary)};
|
|
20
|
+
pre[class*='language-'] {
|
|
21
|
+
overflow-x: auto;
|
|
22
|
+
padding: ${theme.space.md} ${theme.space.xl};
|
|
23
|
+
border-radius: ${theme.radius.md};
|
|
24
|
+
box-shadow: none;
|
|
25
|
+
|
|
26
|
+
code {
|
|
27
|
+
background: unset;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
pre[class*='language-'],
|
|
32
|
+
code[class*='language-'] {
|
|
33
|
+
color: var(--prism-base);
|
|
34
|
+
background: var(--prism-block-background);
|
|
35
|
+
font-size: ${theme.font.size.sm};
|
|
36
|
+
text-shadow: none;
|
|
37
|
+
font-family: ${theme.font.family.mono};
|
|
38
|
+
direction: ltr;
|
|
39
|
+
text-align: left;
|
|
40
|
+
white-space: pre;
|
|
41
|
+
word-spacing: normal;
|
|
42
|
+
word-break: normal;
|
|
43
|
+
-moz-tab-size: 4;
|
|
44
|
+
-o-tab-size: 4;
|
|
45
|
+
tab-size: 4;
|
|
46
|
+
-webkit-hyphens: none;
|
|
47
|
+
-moz-hyphens: none;
|
|
48
|
+
-ms-hyphens: none;
|
|
49
|
+
hyphens: none;
|
|
50
|
+
|
|
51
|
+
.namespace {
|
|
52
|
+
opacity: 0.7;
|
|
53
|
+
}
|
|
54
|
+
.token.comment,
|
|
55
|
+
.token.prolog,
|
|
56
|
+
.token.doctype,
|
|
57
|
+
.token.cdata {
|
|
58
|
+
color: var(--prism-comment);
|
|
59
|
+
}
|
|
60
|
+
.token.punctuation {
|
|
61
|
+
color: var(--prism-punctuation);
|
|
62
|
+
}
|
|
63
|
+
.token.property,
|
|
64
|
+
.token.tag,
|
|
65
|
+
.token.boolean,
|
|
66
|
+
.token.number,
|
|
67
|
+
.token.constant,
|
|
68
|
+
.token.symbol,
|
|
69
|
+
.token.deleted {
|
|
70
|
+
color: var(--prism-property);
|
|
71
|
+
}
|
|
72
|
+
.token.selector,
|
|
73
|
+
.token.attr-name,
|
|
74
|
+
.token.string,
|
|
75
|
+
.token.char,
|
|
76
|
+
.token.builtin,
|
|
77
|
+
.token.inserted {
|
|
78
|
+
color: var(--prism-selector);
|
|
79
|
+
}
|
|
80
|
+
.token.operator,
|
|
81
|
+
.token.entity,
|
|
82
|
+
.token.url,
|
|
83
|
+
.language-css .token.string,
|
|
84
|
+
.style .token.string {
|
|
85
|
+
color: var(--prism-operator);
|
|
86
|
+
background: none;
|
|
87
|
+
}
|
|
88
|
+
.token.atrule,
|
|
89
|
+
.token.attr-value,
|
|
90
|
+
.token.keyword {
|
|
91
|
+
color: var(--prism-keyword);
|
|
92
|
+
}
|
|
93
|
+
.token.function {
|
|
94
|
+
color: var(--prism-function);
|
|
95
|
+
}
|
|
96
|
+
.token.regex,
|
|
97
|
+
.token.important,
|
|
98
|
+
.token.variable {
|
|
99
|
+
color: var(--prism-variable);
|
|
100
|
+
}
|
|
101
|
+
.token.important,
|
|
102
|
+
.token.bold {
|
|
103
|
+
font-weight: ${theme.font.weight.sans.medium};
|
|
104
|
+
}
|
|
105
|
+
.token.italic {
|
|
106
|
+
font-style: italic;
|
|
107
|
+
}
|
|
108
|
+
.token.entity {
|
|
109
|
+
cursor: help;
|
|
110
|
+
}
|
|
111
|
+
.line-highlight {
|
|
112
|
+
position: absolute;
|
|
113
|
+
left: -${theme.space.xl};
|
|
114
|
+
right: 0;
|
|
115
|
+
background: var(--prism-highlight-background);
|
|
116
|
+
box-shadow: inset 5px 0 0 var(--prism-highlight-accent);
|
|
117
|
+
z-index: 0;
|
|
118
|
+
pointer-events: none;
|
|
119
|
+
line-height: inherit;
|
|
120
|
+
white-space: pre;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
pre[data-line] {
|
|
125
|
+
position: relative;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
pre[class*='language-'] > code[class*='language-'] {
|
|
129
|
+
position: relative;
|
|
130
|
+
z-index: 1;
|
|
131
|
+
}
|
|
132
|
+
`;
|
|
133
|
+
export { codeBlockStyles };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import type { DistributedOmit } from 'type-fest';
|
|
3
|
+
import { type ControlProps } from './control.js';
|
|
4
|
+
import type { MultipleListProps, SingleListProps } from './list.js';
|
|
5
|
+
import type { SelectKey, SelectOption, SelectOptionOrSection, SelectSection } from './types.js';
|
|
6
|
+
export type { SelectOption, SelectOptionOrSection, SelectSection, SelectKey };
|
|
7
|
+
interface BaseSelectProps<Value extends SelectKey> extends Omit<ControlProps, 'onClear' | 'clearable'> {
|
|
8
|
+
options: Array<SelectOptionOrSection<Value>>;
|
|
9
|
+
/**
|
|
10
|
+
* Number of options above which virtualization will be enabled.
|
|
11
|
+
* Note that virtualization is always disabled if there are sections in the options.
|
|
12
|
+
* @default 150
|
|
13
|
+
*/
|
|
14
|
+
virtualizeThreshold?: number;
|
|
15
|
+
}
|
|
16
|
+
export type SingleSelectProps<Value extends SelectKey> = BaseSelectProps<Value> & DistributedOmit<SingleListProps<Value>, 'children' | 'items' | 'mode' | 'label'>;
|
|
17
|
+
export type MultipleSelectProps<Value extends SelectKey> = BaseSelectProps<Value> & DistributedOmit<MultipleListProps<Value>, 'children' | 'items' | 'mode' | 'label'>;
|
|
18
|
+
export type SelectProps<Value extends SelectKey> = SingleSelectProps<Value> | MultipleSelectProps<Value>;
|
|
19
|
+
export declare function CompactSelect<Value extends number>(props: SelectProps<Value>): React.JSX.Element;
|
|
20
|
+
export declare function CompactSelect<Value extends string>(props: SelectProps<Value>): React.JSX.Element;
|
|
21
|
+
export declare function CompactSelect<Value extends SelectKey>(props: SelectProps<Value>): React.JSX.Element;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { jsx, jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { createElement } from "@emotion/react";
|
|
3
|
+
import { useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { Item, Section } from "@react-stately/collections";
|
|
5
|
+
import { useTranslation } from "../translation/index.js";
|
|
6
|
+
import { Control } from "./control.js";
|
|
7
|
+
import { List } from "./list.js";
|
|
8
|
+
import { EmptyMessage } from "./styles.js";
|
|
9
|
+
import { getDuplicateOptionKeysInfo, getItemsWithKeys, shouldCloseOnSelect } from "./utils.js";
|
|
10
|
+
import * as __rspack_external__sentry_react_f0cda475 from "@sentry/react";
|
|
11
|
+
function CompactSelect({ options, value, onChange, multiple, clearable, isOptionDisabled, sizeLimit, sizeLimitMessage, virtualizeThreshold, mode, disabled, emptyMessage, size = 'md', closeOnSelect, menuWidth, ...controlProps }) {
|
|
12
|
+
const { t } = useTranslation();
|
|
13
|
+
const generatedTriggerId = useId();
|
|
14
|
+
const triggerId = controlProps.triggerId ?? generatedTriggerId;
|
|
15
|
+
const listProps = useMemo(()=>{
|
|
16
|
+
if (multiple) ;
|
|
17
|
+
return {
|
|
18
|
+
clearable,
|
|
19
|
+
multiple,
|
|
20
|
+
value,
|
|
21
|
+
onChange,
|
|
22
|
+
closeOnSelect,
|
|
23
|
+
mode
|
|
24
|
+
};
|
|
25
|
+
}, [
|
|
26
|
+
multiple,
|
|
27
|
+
clearable,
|
|
28
|
+
value,
|
|
29
|
+
onChange,
|
|
30
|
+
closeOnSelect,
|
|
31
|
+
mode
|
|
32
|
+
]);
|
|
33
|
+
const [measuredMenuWidth, setMeasuredMenuWidth] = useState();
|
|
34
|
+
const [hasMeasured, setHasMeasured] = useState(false);
|
|
35
|
+
const needsMeasuring = !menuWidth && !hasMeasured && shouldVirtualize(options, virtualizeThreshold);
|
|
36
|
+
const menuRef = useCallback((element)=>{
|
|
37
|
+
if (element && needsMeasuring) setMeasuredMenuWidth(element.offsetWidth + 1);
|
|
38
|
+
setHasMeasured(true);
|
|
39
|
+
}, [
|
|
40
|
+
needsMeasuring
|
|
41
|
+
]);
|
|
42
|
+
const controlDisabled = disabled ?? options?.length === 0;
|
|
43
|
+
const allItemsWithKey = useMemo(()=>getItemsWithKeys(options), [
|
|
44
|
+
options
|
|
45
|
+
]);
|
|
46
|
+
const longestOptionItemsWithKey = useMemo(()=>{
|
|
47
|
+
if (needsMeasuring) {
|
|
48
|
+
let longestOption;
|
|
49
|
+
let longestLength = -1;
|
|
50
|
+
for (const option of options){
|
|
51
|
+
const length = 'options' in option ? 0 : option.textValue ? option.textValue.length : 'string' == typeof option.label ? option.label.length : 0;
|
|
52
|
+
if (length > longestLength) {
|
|
53
|
+
longestOption = option;
|
|
54
|
+
longestLength = length;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return longestOption ? getItemsWithKeys([
|
|
58
|
+
longestOption
|
|
59
|
+
]) : [];
|
|
60
|
+
}
|
|
61
|
+
return [];
|
|
62
|
+
}, [
|
|
63
|
+
needsMeasuring,
|
|
64
|
+
options
|
|
65
|
+
]);
|
|
66
|
+
const itemsWithKey = needsMeasuring ? longestOptionItemsWithKey : allItemsWithKey;
|
|
67
|
+
const componentTitle = useMemo(()=>'string' == typeof controlProps.menuTitle ? controlProps.menuTitle : 'unknown', [
|
|
68
|
+
controlProps.menuTitle
|
|
69
|
+
]);
|
|
70
|
+
const lastLoggedDuplicateKeySignatureRef = useRef(void 0);
|
|
71
|
+
useEffect(()=>{
|
|
72
|
+
const { duplicateOptionKeys, hasSections, optionCount } = getDuplicateOptionKeysInfo(allItemsWithKey);
|
|
73
|
+
if (0 === duplicateOptionKeys.length) {
|
|
74
|
+
lastLoggedDuplicateKeySignatureRef.current = void 0;
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const duplicateOptionKeySignature = duplicateOptionKeys.join(',');
|
|
78
|
+
if (lastLoggedDuplicateKeySignatureRef.current === duplicateOptionKeySignature) return;
|
|
79
|
+
lastLoggedDuplicateKeySignatureRef.current = duplicateOptionKeySignature;
|
|
80
|
+
__rspack_external__sentry_react_f0cda475.logger.error('CompactSelect has duplicate option keys', {
|
|
81
|
+
component_title: componentTitle,
|
|
82
|
+
duplicate_option_key_count: duplicateOptionKeys.length,
|
|
83
|
+
duplicate_option_key_signature: duplicateOptionKeySignature,
|
|
84
|
+
has_sections: hasSections,
|
|
85
|
+
option_count: optionCount,
|
|
86
|
+
virtualize_threshold: virtualizeThreshold ?? 150
|
|
87
|
+
});
|
|
88
|
+
}, [
|
|
89
|
+
allItemsWithKey,
|
|
90
|
+
componentTitle,
|
|
91
|
+
virtualizeThreshold
|
|
92
|
+
]);
|
|
93
|
+
return /*#__PURE__*/ jsxs(Control, {
|
|
94
|
+
...controlProps,
|
|
95
|
+
menuWidth: menuWidth ?? measuredMenuWidth,
|
|
96
|
+
menuHeight: needsMeasuring ? '1px' : void 0,
|
|
97
|
+
triggerId: triggerId,
|
|
98
|
+
disabled: controlDisabled,
|
|
99
|
+
mode: mode,
|
|
100
|
+
size: size,
|
|
101
|
+
items: allItemsWithKey,
|
|
102
|
+
isOptionDisabled: isOptionDisabled,
|
|
103
|
+
value: value,
|
|
104
|
+
clearable: clearable,
|
|
105
|
+
onClear: ({ overlayState })=>{
|
|
106
|
+
if (clearable) {
|
|
107
|
+
multiple ? onChange([]) : onChange(void 0);
|
|
108
|
+
if (shouldCloseOnSelect?.({
|
|
109
|
+
...listProps,
|
|
110
|
+
selectedOptions: []
|
|
111
|
+
})) overlayState?.close();
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
menuRef: menuRef,
|
|
115
|
+
children: [
|
|
116
|
+
/*#__PURE__*/ jsx(List, {
|
|
117
|
+
...listProps,
|
|
118
|
+
items: itemsWithKey,
|
|
119
|
+
isOptionDisabled: isOptionDisabled,
|
|
120
|
+
size: size,
|
|
121
|
+
sizeLimit: sizeLimit,
|
|
122
|
+
sizeLimitMessage: sizeLimitMessage,
|
|
123
|
+
virtualized: shouldVirtualize(itemsWithKey, virtualizeThreshold),
|
|
124
|
+
"aria-labelledby": triggerId,
|
|
125
|
+
children: (item)=>{
|
|
126
|
+
if ('options' in item) return /*#__PURE__*/ jsx(Section, {
|
|
127
|
+
title: item.label,
|
|
128
|
+
children: item.options.map((opt)=>/*#__PURE__*/ createElement(Item, {
|
|
129
|
+
...opt,
|
|
130
|
+
key: opt.key
|
|
131
|
+
}, opt.label))
|
|
132
|
+
}, item.key);
|
|
133
|
+
return /*#__PURE__*/ createElement(Item, {
|
|
134
|
+
...item,
|
|
135
|
+
key: item.key
|
|
136
|
+
}, item.label);
|
|
137
|
+
}
|
|
138
|
+
}),
|
|
139
|
+
/*#__PURE__*/ jsx(EmptyMessage, {
|
|
140
|
+
children: emptyMessage ?? t('No options found')
|
|
141
|
+
})
|
|
142
|
+
]
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
function shouldVirtualize(items, virtualizeThreshold = 150) {
|
|
146
|
+
const hasSections = items.some((item)=>'options' in item);
|
|
147
|
+
if (hasSections) return false;
|
|
148
|
+
return items.length > virtualizeThreshold;
|
|
149
|
+
}
|
|
150
|
+
export { CompactSelect };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import type { DistributedOmit } from 'type-fest';
|
|
3
|
+
import { type ButtonProps } from '../button/index.js';
|
|
4
|
+
import type { ControlProps } from './control.js';
|
|
5
|
+
import type { MultipleListProps, SingleListProps } from './list.js';
|
|
6
|
+
import type { SelectKey, SelectOption } from './types.js';
|
|
7
|
+
interface BaseCompositeSelectRegion<Value extends SelectKey> {
|
|
8
|
+
options: Array<SelectOption<Value>>;
|
|
9
|
+
key?: SelectKey;
|
|
10
|
+
label?: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A single-selection (only one option can be selected at a time) "region" inside a
|
|
14
|
+
* composite select. Each "region" is a separated, self-contained selectable list (each
|
|
15
|
+
* renders as a `ul` with its own list state) whose selection values don't interfere
|
|
16
|
+
* with one another.
|
|
17
|
+
*/
|
|
18
|
+
type SingleCompositeSelectRegion<Value extends SelectKey> = BaseCompositeSelectRegion<Value> & DistributedOmit<SingleListProps<Value>, 'children' | 'items' | 'mode' | 'size'>;
|
|
19
|
+
/**
|
|
20
|
+
* A multiple-selection (multiple options can be selected at the same time) "region"
|
|
21
|
+
* inside a composite select. Each "region" is a separated, self-contained selectable
|
|
22
|
+
* list (each renders as a `ul` with its own list state) whose selection values don't
|
|
23
|
+
* interfere with one another.
|
|
24
|
+
*/
|
|
25
|
+
type MultipleCompositeSelectRegion<Value extends SelectKey> = BaseCompositeSelectRegion<Value> & DistributedOmit<MultipleListProps<Value>, 'children' | 'items' | 'mode' | 'size'>;
|
|
26
|
+
/**
|
|
27
|
+
* A "region" inside a composite select. Each "region" is a separated, self-contained
|
|
28
|
+
* selectable list (each renders as a `ul` with its own list state) whose selection
|
|
29
|
+
* values don't interfere with one another.
|
|
30
|
+
*/
|
|
31
|
+
type CompositeSelectRegion<Value extends SelectKey> = SingleCompositeSelectRegion<Value> | MultipleCompositeSelectRegion<Value>;
|
|
32
|
+
/**
|
|
33
|
+
* A React child inside CompositeSelect. This helps ensure that the only non-falsy child
|
|
34
|
+
* allowed inside CompositeSelect is CompositeSelect.Region
|
|
35
|
+
*/
|
|
36
|
+
type CompositeSelectChild = React.ReactElement<CompositeSelectRegion<SelectKey>> | false | null | undefined;
|
|
37
|
+
interface CompositeSelectProps extends Omit<ControlProps, 'clearable' | 'triggerProps' | 'trigger'> {
|
|
38
|
+
/**
|
|
39
|
+
* The "regions" inside this composite selector. Each region functions as a separated,
|
|
40
|
+
* self-contained selectable list (each renders as a `ul` with its own list state)
|
|
41
|
+
* whose values don't interfere with one another.
|
|
42
|
+
*/
|
|
43
|
+
children: CompositeSelectChild | CompositeSelectChild[];
|
|
44
|
+
trigger: NonNullable<ControlProps['trigger']>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Flexible select component with a customizable trigger button
|
|
48
|
+
*/
|
|
49
|
+
declare function CompositeSelect({ children, mode, disabled, emptyMessage, size, ...controlProps }: CompositeSelectProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
50
|
+
declare namespace CompositeSelect {
|
|
51
|
+
var Region: <Value extends SelectKey>(_props: CompositeSelectRegion<Value>) => null;
|
|
52
|
+
var ClearButton: (props: DistributedOmit<ButtonProps, "variant" | "size" | "children">) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
53
|
+
}
|
|
54
|
+
export { CompositeSelect };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { jsx, jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { createElement } from "@emotion/react";
|
|
3
|
+
import { Children, isValidElement, useMemo } from "react";
|
|
4
|
+
import styled from "@emotion/styled";
|
|
5
|
+
import { FocusScope } from "@react-aria/focus";
|
|
6
|
+
import { Item } from "@react-stately/collections";
|
|
7
|
+
import { useTranslation } from "../translation/index.js";
|
|
8
|
+
import { ClearButton, Control } from "./control.js";
|
|
9
|
+
import { List } from "./list.js";
|
|
10
|
+
import { EmptyMessage } from "./styles.js";
|
|
11
|
+
import { getItemsWithKeys } from "./utils.js";
|
|
12
|
+
function CompositeSelect({ children, mode, disabled, emptyMessage, size = 'md', ...controlProps }) {
|
|
13
|
+
const { t } = useTranslation();
|
|
14
|
+
const items = useMemo(()=>Children.toArray(children).flatMap((child, regionIndex)=>{
|
|
15
|
+
if (!/*#__PURE__*/ isValidElement(child)) return [];
|
|
16
|
+
const { options, isOptionDisabled } = child.props;
|
|
17
|
+
return getItemsWithKeys(options).map((option)=>({
|
|
18
|
+
...option,
|
|
19
|
+
key: `${regionIndex}-${String(option.key)}`,
|
|
20
|
+
disabled: option.disabled || isOptionDisabled?.(option)
|
|
21
|
+
}));
|
|
22
|
+
}), [
|
|
23
|
+
children
|
|
24
|
+
]);
|
|
25
|
+
return /*#__PURE__*/ jsx(Control, {
|
|
26
|
+
...controlProps,
|
|
27
|
+
mode: mode,
|
|
28
|
+
size: size,
|
|
29
|
+
disabled: disabled,
|
|
30
|
+
items: items,
|
|
31
|
+
children: /*#__PURE__*/ jsx(FocusScope, {
|
|
32
|
+
children: /*#__PURE__*/ jsxs(RegionsWrap, {
|
|
33
|
+
children: [
|
|
34
|
+
Children.map(children, (child)=>{
|
|
35
|
+
if (!child) return null;
|
|
36
|
+
return /*#__PURE__*/ jsx(Region, {
|
|
37
|
+
...child.props,
|
|
38
|
+
mode: mode,
|
|
39
|
+
size: size
|
|
40
|
+
});
|
|
41
|
+
}),
|
|
42
|
+
/*#__PURE__*/ jsx(EmptyMessage, {
|
|
43
|
+
children: emptyMessage ?? t('No options found')
|
|
44
|
+
})
|
|
45
|
+
]
|
|
46
|
+
})
|
|
47
|
+
})
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
CompositeSelect.Region = function(_props) {
|
|
51
|
+
return null;
|
|
52
|
+
};
|
|
53
|
+
CompositeSelect.ClearButton = function(props) {
|
|
54
|
+
const { t } = useTranslation();
|
|
55
|
+
return /*#__PURE__*/ jsx(ClearButton, {
|
|
56
|
+
size: "zero",
|
|
57
|
+
variant: "transparent",
|
|
58
|
+
...props,
|
|
59
|
+
children: t('Clear')
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
function Region({ options, isOptionDisabled, size, label, ...props }) {
|
|
63
|
+
const itemsWithKey = useMemo(()=>getItemsWithKeys(options), [
|
|
64
|
+
options
|
|
65
|
+
]);
|
|
66
|
+
return /*#__PURE__*/ jsx(List, {
|
|
67
|
+
...props,
|
|
68
|
+
items: itemsWithKey,
|
|
69
|
+
isOptionDisabled: isOptionDisabled,
|
|
70
|
+
shouldFocusWrap: false,
|
|
71
|
+
size: size,
|
|
72
|
+
label: label,
|
|
73
|
+
children: (opt)=>/*#__PURE__*/ createElement(Item, {
|
|
74
|
+
...opt,
|
|
75
|
+
key: opt.key
|
|
76
|
+
}, opt.label)
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
const RegionsWrap = styled('div')`
|
|
80
|
+
min-height: 0;
|
|
81
|
+
overflow: auto;
|
|
82
|
+
padding: ${(p)=>p.theme.space.xs} 0;
|
|
83
|
+
|
|
84
|
+
/* Add 1px to top padding if preceded by menu header, to account for the header's
|
|
85
|
+
shadow border */
|
|
86
|
+
[data-menu-has-header='true'] > div > & {
|
|
87
|
+
padding-top: calc(${(p)=>p.theme.space.xs} + 1px);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* Add 1px to bottom padding if succeeded by menu footer, to account for the footer's
|
|
91
|
+
shadow border */
|
|
92
|
+
[data-menu-has-footer='true'] > div > & {
|
|
93
|
+
padding-bottom: calc(${(p)=>p.theme.space.xs} + 1px);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* Remove padding inside lists */
|
|
97
|
+
> ul {
|
|
98
|
+
padding: 0;
|
|
99
|
+
}
|
|
100
|
+
`;
|
|
101
|
+
export { CompositeSelect };
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { OverlayTriggerState } from '@react-stately/overlays';
|
|
3
|
+
import { type TriggerProps } from '../overlayTrigger.js';
|
|
4
|
+
import type { FormSize } from '../theme/index.js';
|
|
5
|
+
import type { UseOverlayProps } from '../useOverlay.js';
|
|
6
|
+
import type { SingleListProps } from './list.js';
|
|
7
|
+
import type { SearchConfig, SelectKey, SelectOptionOrSectionWithKey, SelectOptionWithKey } from './types.js';
|
|
8
|
+
export interface ControlProps extends Omit<React.BaseHTMLAttributes<HTMLDivElement>, keyof Omit<SingleListProps<SelectKey>, 'children' | 'items' | 'mode' | 'label'> | 'defaultValue'>, Pick<UseOverlayProps, 'isOpen' | 'onClose' | 'offset' | 'position' | 'isDismissable' | 'shouldCloseOnBlur' | 'shouldCloseOnInteractOutside' | 'onInteractOutside' | 'preventOverflowOptions' | 'flipOptions' | 'strategy'> {
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
/**
|
|
12
|
+
* If true, there will be a "Clear" button in the menu header.
|
|
13
|
+
*/
|
|
14
|
+
clearable?: boolean;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Message to be displayed when all options have been filtered out (via search).
|
|
18
|
+
*/
|
|
19
|
+
emptyMessage?: React.ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* If true, all select options will be hidden. This should only be used on a temporary
|
|
22
|
+
* basis in conjunction with `menuBody` to display special views/states (e.g. a
|
|
23
|
+
* secondary date range selector).
|
|
24
|
+
*/
|
|
25
|
+
hideOptions?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* If true, there will be a loading indicator in the menu header.
|
|
28
|
+
*/
|
|
29
|
+
loading?: boolean;
|
|
30
|
+
maxMenuHeight?: number | string;
|
|
31
|
+
/**
|
|
32
|
+
* Optional content to display below the menu's header and above the options.
|
|
33
|
+
*/
|
|
34
|
+
menuBody?: React.ReactNode | ((actions: {
|
|
35
|
+
closeOverlay: () => void;
|
|
36
|
+
}) => React.JSX.Element);
|
|
37
|
+
/**
|
|
38
|
+
* Footer to be rendered at the bottom of the menu.
|
|
39
|
+
*/
|
|
40
|
+
menuFooter?: React.ReactNode | ((actions: {
|
|
41
|
+
closeOverlay: () => void;
|
|
42
|
+
resetSearch: () => void;
|
|
43
|
+
}) => React.ReactNode);
|
|
44
|
+
/**
|
|
45
|
+
* Items to be displayed in the trailing (right) side of the menu's header.
|
|
46
|
+
*/
|
|
47
|
+
menuHeaderTrailingItems?: React.ReactNode | ((actions: {
|
|
48
|
+
closeOverlay: () => void;
|
|
49
|
+
}) => React.ReactNode);
|
|
50
|
+
menuHeight?: number | string;
|
|
51
|
+
/**
|
|
52
|
+
* Minimum width for the menu overlay. When unset, the overlay's min-width matches
|
|
53
|
+
* the trigger's width (overlay default). When set, this value is used instead —
|
|
54
|
+
* useful when the trigger is intentionally narrow but the options need more room.
|
|
55
|
+
*/
|
|
56
|
+
menuMinWidth?: number | string;
|
|
57
|
+
/**
|
|
58
|
+
* Title to display in the menu's header. Keep the title as short as possible.
|
|
59
|
+
*/
|
|
60
|
+
menuTitle?: React.ReactNode;
|
|
61
|
+
menuWidth?: number | string;
|
|
62
|
+
/**
|
|
63
|
+
* Controls the selection widget type.
|
|
64
|
+
*
|
|
65
|
+
* - `'list'` (default) — a one-dimensional listbox navigated with Arrow Up/Down.
|
|
66
|
+
* - `'grid'` — a two-dimensional grid list where Arrow Up/Down moves between rows
|
|
67
|
+
* and Arrow Left/Right moves between columns. Use this when options contain
|
|
68
|
+
* interactive child elements (buttons/links) that need to be keyboard-reachable.
|
|
69
|
+
*/
|
|
70
|
+
mode?: 'list' | 'grid';
|
|
71
|
+
/**
|
|
72
|
+
* Called when the clear button is clicked (applicable only when `clearable` is
|
|
73
|
+
* true).
|
|
74
|
+
*/
|
|
75
|
+
onClear?: (props: {
|
|
76
|
+
overlayState: OverlayTriggerState;
|
|
77
|
+
}) => void;
|
|
78
|
+
/**
|
|
79
|
+
* Called when the menu is opened or closed.
|
|
80
|
+
*/
|
|
81
|
+
onOpenChange?: (newOpenState: boolean) => void;
|
|
82
|
+
/**
|
|
83
|
+
* Search configuration. When provided, enables the search input.
|
|
84
|
+
* Pass `true` to enable search with default settings, or a config object
|
|
85
|
+
* to customise placeholder, filtering, or the onChange callback.
|
|
86
|
+
*/
|
|
87
|
+
search?: boolean | SearchConfig<SelectKey>;
|
|
88
|
+
size?: FormSize;
|
|
89
|
+
/**
|
|
90
|
+
* Optional replacement for the default trigger button. Note that the replacement must
|
|
91
|
+
* forward `props` and `ref` its outer wrap, otherwise many accessibility features
|
|
92
|
+
* won't work correctly.
|
|
93
|
+
*/
|
|
94
|
+
trigger?: (props: TriggerProps, isOpen: boolean) => React.ReactNode;
|
|
95
|
+
triggerId?: string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Controls Select's open state and exposes SelectContext to all chidlren.
|
|
99
|
+
*/
|
|
100
|
+
export declare function Control<Value extends SelectKey>({ autoFocus, trigger, triggerId, isOpen, onClose, isDismissable, onInteractOutside, shouldCloseOnInteractOutside, shouldCloseOnBlur, preventOverflowOptions, flipOptions, disabled, position, strategy, offset, hideOptions, menuTitle, maxMenuHeight, menuWidth, menuMinWidth, menuHeight, menuHeaderTrailingItems, menuBody, menuFooter, onOpenChange, items, isOptionDisabled, value, size, search: searchConfig, clearable, onClear, loading, mode, children, menuRef, ...wrapperProps }: ControlProps & {
|
|
101
|
+
isOptionDisabled?: (option: SelectOptionWithKey<Value>) => boolean;
|
|
102
|
+
items?: Array<SelectOptionOrSectionWithKey<Value>>;
|
|
103
|
+
menuRef?: React.Ref<HTMLDivElement>;
|
|
104
|
+
value?: Value | Value[] | undefined;
|
|
105
|
+
}): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
106
|
+
export declare const TriggerLabel: import("@emotion/styled").StyledComponent<{
|
|
107
|
+
theme?: import("@emotion/react").Theme;
|
|
108
|
+
as?: React.ElementType;
|
|
109
|
+
}, React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
110
|
+
export declare const ClearButton: import("@emotion/styled").StyledComponent<import("../button/index.js").ButtonProps & {
|
|
111
|
+
theme?: import("@emotion/react").Theme;
|
|
112
|
+
}, {}, {}>;
|