@sproutsocial/seeds-react-menu 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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +35 -0
- package/dist/esm/index.js +221 -137
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +126 -101
- package/dist/index.d.ts +126 -101
- package/dist/index.js +236 -151
- package/dist/index.js.map +1 -1
- package/package.json +12 -12
- package/src/ActionMenu/ActionMenu.tsx +10 -3
- package/src/ActionMenu/ActionMenuTypes.ts +10 -6
- package/src/ActionMenu/__tests__/ActionMenu.test.tsx +0 -22
- package/src/ActionMenu/__tests__/ActionMenu.typetest.tsx +32 -3
- package/src/Autocomplete/Autocomplete.stories.tsx +24 -0
- package/src/Autocomplete/Autocomplete.tsx +10 -4
- package/src/Autocomplete/AutocompleteTypes.ts +6 -3
- package/src/Autocomplete/__tests__/Autocomplete.typetest.tsx +34 -3
- package/src/MenuContent/MenuContent.tsx +14 -1
- package/src/MenuContent/MenuContentTypes.ts +5 -5
- package/src/MenuContent/__tests__/MenuContent.typetest.tsx +17 -1
- package/src/MenuGroup/MenuGroup.feature +6 -6
- package/src/MenuGroup/MenuGroup.tsx +2 -1
- package/src/MenuGroup/MenuGroupTypes.ts +4 -6
- package/src/MenuGroup/__tests__/MenuGroup.typetest.tsx +23 -4
- package/src/MenuItem/MenuItem.tsx +0 -1
- package/src/MultiSelectMenu/MultiSelectMenu.tsx +10 -3
- package/src/MultiSelectMenu/MultiSelectMenuTypes.ts +8 -6
- package/src/MultiSelectMenu/__tests__/MultiSelectMenu.test.tsx +0 -43
- package/src/MultiSelectMenu/__tests__/MultiSelectMenu.typetest.tsx +29 -2
- package/src/SingleSelectMenu/SingleSelectMenu.tsx +10 -3
- package/src/SingleSelectMenu/SingleSelectMenuTypes.ts +7 -5
- package/src/SingleSelectMenu/__tests__/SingleSelectMenu.typetest.tsx +32 -2
- package/src/__tests__/Menu.test.tsx +38 -0
- package/src/hooks/useMenuChildren.tsx +210 -0
- package/src/index.ts +1 -1
- package/src/types.ts +26 -1
- package/src/hooks/useItemsFromChildren.tsx +0 -131
package/dist/index.d.mts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as downshift from 'downshift';
|
|
3
|
-
import {
|
|
3
|
+
import { UseComboboxProps, UseSelectProps, UseMultipleSelectionProps, UseComboboxReturnValue, UseSelectReturnValue, UseMultipleSelectionReturnValue, GetItemPropsOptions, UseComboboxGetInputPropsOptions } from 'downshift';
|
|
4
|
+
import { TypeBorderSystemProps, TypeColorSystemProps, TypeFlexboxSystemProps, TypeGridSystemProps, TypeLayoutSystemProps, TypePositionSystemProps, TypeSpaceSystemProps, TypeTypographySystemProps, TypeStyledComponentsCommonProps } from '@sproutsocial/seeds-react-system-props';
|
|
4
5
|
import * as React$1 from 'react';
|
|
5
6
|
import React__default, { ReactNode } from 'react';
|
|
6
|
-
import {
|
|
7
|
+
import { TypePopoutProps } from '@sproutsocial/seeds-react-popout';
|
|
7
8
|
import * as styled_components from 'styled-components';
|
|
8
9
|
import { HTMLMotionProps } from 'motion/react';
|
|
9
10
|
import { TypeBoxProps } from '@sproutsocial/seeds-react-box';
|
|
10
11
|
export { TypeBoxProps as TypeMenuFooterProps } from '@sproutsocial/seeds-react-box';
|
|
11
12
|
import * as _sproutsocial_seeds_react_text from '@sproutsocial/seeds-react-text';
|
|
12
|
-
import { TypePopoutProps } from '@sproutsocial/seeds-react-popout';
|
|
13
13
|
import { TypeLabelProps } from '@sproutsocial/seeds-react-label';
|
|
14
14
|
import { TypeButtonProps } from '@sproutsocial/seeds-react-button';
|
|
15
15
|
import { TypeInputProps } from '@sproutsocial/seeds-react-input';
|
|
@@ -25,15 +25,13 @@ type TypeMenuItemRoles = (typeof MENU_ITEM_ROLES)[keyof typeof MENU_ITEM_ROLES];
|
|
|
25
25
|
|
|
26
26
|
interface TypeMenuGroupStyledProps extends TypeBorderSystemProps, TypeColorSystemProps, TypeFlexboxSystemProps, TypeGridSystemProps, TypeLayoutSystemProps, TypePositionSystemProps, TypeSpaceSystemProps, TypeTypographySystemProps {
|
|
27
27
|
}
|
|
28
|
-
interface
|
|
28
|
+
interface TypeBaseMenuGroupProps extends TypeMenuGroupStyledProps, Omit<React.ComponentPropsWithoutRef<"ul">, "color"> {
|
|
29
29
|
id: string;
|
|
30
30
|
isSingleSelect?: boolean;
|
|
31
31
|
title?: string;
|
|
32
|
-
children?: ReactNode;
|
|
33
|
-
items?: TypeMenuItemProps[];
|
|
34
|
-
MenuItemComponent?: typeof MenuItem;
|
|
35
32
|
titleAs?: string | React.ComponentType<any>;
|
|
36
33
|
}
|
|
34
|
+
type TypeMenuGroupProps = TypeBaseMenuGroupProps & TypeChildrenOrItems;
|
|
37
35
|
|
|
38
36
|
/**
|
|
39
37
|
* @link https://seeds.sproutsocial.com/components/menu-group/
|
|
@@ -60,6 +58,78 @@ declare const StyledMenuGroup: styled_components.StyledComponent<"li", styled_co
|
|
|
60
58
|
declare const StyledTitle: styled_components.StyledComponent<React$1.FC<_sproutsocial_seeds_react_text.TypeTextProps>, styled_components.DefaultTheme, {}, never>;
|
|
61
59
|
declare const StyledMenuGroupUl: styled_components.StyledComponent<"ul", styled_components.DefaultTheme, {}, never>;
|
|
62
60
|
|
|
61
|
+
interface TypeDownshiftComboboxProps extends Partial<UseComboboxProps<TypeDefaultItemProps>> {
|
|
62
|
+
}
|
|
63
|
+
interface TypeDownshiftSelectProps extends Partial<UseSelectProps<TypeDefaultItemProps>> {
|
|
64
|
+
}
|
|
65
|
+
interface TypeDownshiftMultiSelectProps extends Partial<Omit<UseMultipleSelectionProps<TypeDefaultItemProps>, "stateReducer" | "onStateChange" | "getA11yStatusMessage">> {
|
|
66
|
+
getA11yMultiStatusMessage?: UseMultipleSelectionProps<TypeDefaultItemProps>["getA11yStatusMessage"];
|
|
67
|
+
onMultiSelectStateChange?: UseMultipleSelectionProps<TypeDefaultItemProps>["onStateChange"];
|
|
68
|
+
multiSelectStateReducer?: UseMultipleSelectionProps<TypeDefaultItemProps>["stateReducer"];
|
|
69
|
+
}
|
|
70
|
+
interface TypeDownshiftComboboxReturnValue extends Partial<UseComboboxReturnValue<TypeDefaultItemProps>> {
|
|
71
|
+
}
|
|
72
|
+
interface TypeDownshiftSelectReturnValue extends Partial<UseSelectReturnValue<TypeDefaultItemProps>> {
|
|
73
|
+
}
|
|
74
|
+
interface TypeDownshiftMultiSelectReturnValue extends Partial<UseMultipleSelectionReturnValue<TypeDefaultItemProps>> {
|
|
75
|
+
}
|
|
76
|
+
type TypeDonwshiftSharedReturnValue = "getLabelProps" | "getToggleButtonProps" | "getMenuProps";
|
|
77
|
+
type TypeDonwshiftSharedProps = "onHighlightedIndexChange" | "onIsOpenChange" | "onSelectedItemChange" | "onStateChange" | "stateReducer";
|
|
78
|
+
interface TypeMenuContextProps extends Omit<TypeDownshiftComboboxReturnValue, TypeDonwshiftSharedReturnValue>, Omit<TypeDownshiftComboboxProps, TypeDonwshiftSharedProps>, Omit<TypeDownshiftSelectReturnValue, TypeDonwshiftSharedReturnValue>, Omit<TypeDownshiftSelectProps, TypeDonwshiftSharedProps>, TypeDownshiftMultiSelectReturnValue, TypeDownshiftMultiSelectProps {
|
|
79
|
+
items: TypeDefaultItemProps[];
|
|
80
|
+
itemsMap?: {
|
|
81
|
+
[key: string]: TypeDefaultItemProps;
|
|
82
|
+
};
|
|
83
|
+
isListbox?: boolean;
|
|
84
|
+
onHighlightedIndexChange?: TypeDownshiftComboboxProps["onHighlightedIndexChange"] | TypeDownshiftSelectProps["onHighlightedIndexChange"];
|
|
85
|
+
onIsOpenChange?: TypeDownshiftComboboxProps["onIsOpenChange"] | TypeDownshiftSelectProps["onIsOpenChange"];
|
|
86
|
+
onSelectedItemChange?: TypeDownshiftComboboxProps["onSelectedItemChange"] | TypeDownshiftSelectProps["onSelectedItemChange"];
|
|
87
|
+
onStateChange?: TypeDownshiftComboboxProps["onStateChange"] | TypeDownshiftSelectProps["onStateChange"];
|
|
88
|
+
stateReducer?: TypeDownshiftComboboxProps["stateReducer"] | TypeDownshiftSelectProps["stateReducer"];
|
|
89
|
+
getLabelProps?: TypeDownshiftComboboxReturnValue["getLabelProps"] | TypeDownshiftSelectReturnValue["getLabelProps"];
|
|
90
|
+
getToggleButtonProps?: TypeDownshiftComboboxReturnValue["getToggleButtonProps"] | TypeDownshiftSelectReturnValue["getToggleButtonProps"];
|
|
91
|
+
getMenuProps?: TypeDownshiftComboboxReturnValue["getMenuProps"] | TypeDownshiftSelectReturnValue["getMenuProps"];
|
|
92
|
+
}
|
|
93
|
+
interface TypeMenuContext extends TypeMenuContextProps {
|
|
94
|
+
itemsMap: {
|
|
95
|
+
[key: string]: TypeDefaultItemProps;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
interface TypeMenuProviderProps {
|
|
99
|
+
children: TypeNotEmptyChildren;
|
|
100
|
+
menuProps: Partial<TypeMenuContextProps>;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Hook for initializing Menu context
|
|
104
|
+
*/
|
|
105
|
+
declare const useMenu: ({ items, isListbox, isOpen, itemsMap: itemsMapFromProps, ...rest }?: Partial<TypeMenuContextProps>) => TypeMenuContext;
|
|
106
|
+
/**
|
|
107
|
+
* MenuContext factory, sets the type and the initial object
|
|
108
|
+
*/
|
|
109
|
+
declare const MenuContext: React__default.Context<TypeMenuContext>;
|
|
110
|
+
/**
|
|
111
|
+
* Provider Component sets the context values into the provider
|
|
112
|
+
*/
|
|
113
|
+
declare const MenuProvider: ({ children, menuProps, }: TypeMenuProviderProps) => react_jsx_runtime.JSX.Element;
|
|
114
|
+
/**
|
|
115
|
+
* Utility hook for consuming MenuContext
|
|
116
|
+
*/
|
|
117
|
+
declare const useMenuContext: () => TypeMenuContext;
|
|
118
|
+
|
|
119
|
+
interface TypeMenuRootOwnProps {
|
|
120
|
+
menuToggleElement: React__default.ReactElement<any>;
|
|
121
|
+
popoutProps?: Partial<Omit<TypePopoutProps, "isOpen" | "setIsOpen" | "content" | "children">>;
|
|
122
|
+
width?: TypePopoutProps["width"];
|
|
123
|
+
}
|
|
124
|
+
interface TypeMenuRootProps extends Partial<TypeMenuProviderProps["menuProps"]>, Pick<TypeMenuProviderProps, "children">, TypeMenuRootOwnProps {
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* @link https://seeds.sproutsocial.com/components/menu-root/
|
|
128
|
+
*
|
|
129
|
+
* @description MenuRoot is a utility component used to handle {@link https://github.com/sproutsocial/seeds/blob/dev/seeds-react/seeds-react-menu/src/MenuContext.tsx | MenuContext}. This component should rarely, if ever, be used directly unless building a custom menu type.
|
|
130
|
+
*/
|
|
131
|
+
declare const MenuRoot: ({ children, menuToggleElement, popoutProps: { focusLockProps, ...popoutProps }, width, ...contextProps }: TypeMenuRootProps) => react_jsx_runtime.JSX.Element;
|
|
132
|
+
|
|
63
133
|
interface TypeDefaultItemProps {
|
|
64
134
|
id: string;
|
|
65
135
|
index: number;
|
|
@@ -68,6 +138,24 @@ interface TypeDefaultItemProps {
|
|
|
68
138
|
menuItemProps?: TypeMenuItemProps;
|
|
69
139
|
menuGroupProps?: TypeMenuGroupProps;
|
|
70
140
|
}
|
|
141
|
+
type TypeBaseChildrenOrItems = {
|
|
142
|
+
/** Allows menu items to be passed in as children. Cannot be used with the items prop.*/
|
|
143
|
+
children?: TypeMenuRootProps["children"];
|
|
144
|
+
/** Allows menu items to be passed in as objects. Cannot be used with the children prop.*/
|
|
145
|
+
items?: TypeMenuItemProps[];
|
|
146
|
+
/** Allows a custom MenuItem component to be used when rendering using the items prop.*/
|
|
147
|
+
MenuItemComponent?: React.ComponentType<TypeMenuItemProps>;
|
|
148
|
+
};
|
|
149
|
+
type TypePropsWithChildren = {
|
|
150
|
+
children: TypeMenuRootProps["children"];
|
|
151
|
+
items?: never;
|
|
152
|
+
MenuItemComponent?: never;
|
|
153
|
+
};
|
|
154
|
+
type TypePropsWithItems = {
|
|
155
|
+
children?: never;
|
|
156
|
+
items: TypeMenuItemProps[];
|
|
157
|
+
};
|
|
158
|
+
type TypeChildrenOrItems = TypeBaseChildrenOrItems & (TypePropsWithChildren | TypePropsWithItems);
|
|
71
159
|
type TypeNotEmptyChildren = React.ReactChild | React.ReactFragment | React.ReactPortal;
|
|
72
160
|
|
|
73
161
|
interface TypeMenuItemStyledProps extends TypeBorderSystemProps, TypeColorSystemProps, TypeFlexboxSystemProps, TypeGridSystemProps, TypeLayoutSystemProps, TypePositionSystemProps, TypeSpaceSystemProps, TypeTypographySystemProps {
|
|
@@ -114,9 +202,9 @@ interface TypeMenuHeaderProps extends Omit<React$1.ComponentPropsWithoutRef<"div
|
|
|
114
202
|
*/
|
|
115
203
|
declare const MenuHeader: ({ children, title, leftAction, rightAction, ...rest }: TypeMenuHeaderProps) => react_jsx_runtime.JSX.Element;
|
|
116
204
|
|
|
117
|
-
interface
|
|
118
|
-
children: ReactNode;
|
|
205
|
+
interface TypeMenuContentBaseProps extends HTMLMotionProps<"ul"> {
|
|
119
206
|
}
|
|
207
|
+
type TypeMenuContentProps = TypeMenuContentBaseProps & TypeChildrenOrItems;
|
|
120
208
|
|
|
121
209
|
/**
|
|
122
210
|
* @link https://seeds.sproutsocial.com/components/menu-content/
|
|
@@ -140,7 +228,7 @@ interface TypeMenuContentProps extends HTMLMotionProps<"ul"> {
|
|
|
140
228
|
* @see {@link https://seeds.sproutsocial.com/components/menu-item/ | MenuItem}
|
|
141
229
|
* @see {@link https://seeds.sproutsocial.com/components/menu-group/ | MenuGroup}
|
|
142
230
|
*/
|
|
143
|
-
declare const MenuContent: ({ id, children, ...rest }: TypeMenuContentProps) => react_jsx_runtime.JSX.Element;
|
|
231
|
+
declare const MenuContent: ({ id, children: childrenProp, items, MenuItemComponent, ...rest }: TypeMenuContentProps) => react_jsx_runtime.JSX.Element | null;
|
|
144
232
|
|
|
145
233
|
/**
|
|
146
234
|
* @link https://seeds.sproutsocial.com/components/menu-footer/
|
|
@@ -151,78 +239,6 @@ declare const MenuContent: ({ id, children, ...rest }: TypeMenuContentProps) =>
|
|
|
151
239
|
*/
|
|
152
240
|
declare const MenuFooter: ({ children, ...rest }: TypeBoxProps) => react_jsx_runtime.JSX.Element;
|
|
153
241
|
|
|
154
|
-
interface TypeDownshiftComboboxProps extends Partial<UseComboboxProps<TypeDefaultItemProps>> {
|
|
155
|
-
}
|
|
156
|
-
interface TypeDownshiftSelectProps extends Partial<UseSelectProps<TypeDefaultItemProps>> {
|
|
157
|
-
}
|
|
158
|
-
interface TypeDownshiftMultiSelectProps extends Partial<Omit<UseMultipleSelectionProps<TypeDefaultItemProps>, "stateReducer" | "onStateChange" | "getA11yStatusMessage">> {
|
|
159
|
-
getA11yMultiStatusMessage?: UseMultipleSelectionProps<TypeDefaultItemProps>["getA11yStatusMessage"];
|
|
160
|
-
onMultiSelectStateChange?: UseMultipleSelectionProps<TypeDefaultItemProps>["onStateChange"];
|
|
161
|
-
multiSelectStateReducer?: UseMultipleSelectionProps<TypeDefaultItemProps>["stateReducer"];
|
|
162
|
-
}
|
|
163
|
-
interface TypeDownshiftComboboxReturnValue extends Partial<UseComboboxReturnValue<TypeDefaultItemProps>> {
|
|
164
|
-
}
|
|
165
|
-
interface TypeDownshiftSelectReturnValue extends Partial<UseSelectReturnValue<TypeDefaultItemProps>> {
|
|
166
|
-
}
|
|
167
|
-
interface TypeDownshiftMultiSelectReturnValue extends Partial<UseMultipleSelectionReturnValue<TypeDefaultItemProps>> {
|
|
168
|
-
}
|
|
169
|
-
type TypeDonwshiftSharedReturnValue = "getLabelProps" | "getToggleButtonProps" | "getMenuProps";
|
|
170
|
-
type TypeDonwshiftSharedProps = "onHighlightedIndexChange" | "onIsOpenChange" | "onSelectedItemChange" | "onStateChange" | "stateReducer";
|
|
171
|
-
interface TypeMenuContextProps extends Omit<TypeDownshiftComboboxReturnValue, TypeDonwshiftSharedReturnValue>, Omit<TypeDownshiftComboboxProps, TypeDonwshiftSharedProps>, Omit<TypeDownshiftSelectReturnValue, TypeDonwshiftSharedReturnValue>, Omit<TypeDownshiftSelectProps, TypeDonwshiftSharedProps>, TypeDownshiftMultiSelectReturnValue, TypeDownshiftMultiSelectProps {
|
|
172
|
-
items: TypeDefaultItemProps[];
|
|
173
|
-
itemsMap?: {
|
|
174
|
-
[key: string]: TypeDefaultItemProps;
|
|
175
|
-
};
|
|
176
|
-
isListbox?: boolean;
|
|
177
|
-
onHighlightedIndexChange?: TypeDownshiftComboboxProps["onHighlightedIndexChange"] | TypeDownshiftSelectProps["onHighlightedIndexChange"];
|
|
178
|
-
onIsOpenChange?: TypeDownshiftComboboxProps["onIsOpenChange"] | TypeDownshiftSelectProps["onIsOpenChange"];
|
|
179
|
-
onSelectedItemChange?: TypeDownshiftComboboxProps["onSelectedItemChange"] | TypeDownshiftSelectProps["onSelectedItemChange"];
|
|
180
|
-
onStateChange?: TypeDownshiftComboboxProps["onStateChange"] | TypeDownshiftSelectProps["onStateChange"];
|
|
181
|
-
stateReducer?: TypeDownshiftComboboxProps["stateReducer"] | TypeDownshiftSelectProps["stateReducer"];
|
|
182
|
-
getLabelProps?: TypeDownshiftComboboxReturnValue["getLabelProps"] | TypeDownshiftSelectReturnValue["getLabelProps"];
|
|
183
|
-
getToggleButtonProps?: TypeDownshiftComboboxReturnValue["getToggleButtonProps"] | TypeDownshiftSelectReturnValue["getToggleButtonProps"];
|
|
184
|
-
getMenuProps?: TypeDownshiftComboboxReturnValue["getMenuProps"] | TypeDownshiftSelectReturnValue["getMenuProps"];
|
|
185
|
-
}
|
|
186
|
-
interface TypeMenuContext extends TypeMenuContextProps {
|
|
187
|
-
itemsMap: {
|
|
188
|
-
[key: string]: TypeDefaultItemProps;
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
interface TypeMenuProviderProps {
|
|
192
|
-
children: TypeNotEmptyChildren;
|
|
193
|
-
menuProps: Partial<TypeMenuContextProps>;
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Hook for initializing Menu context
|
|
197
|
-
*/
|
|
198
|
-
declare const useMenu: ({ items, isListbox, isOpen, itemsMap: itemsMapFromProps, ...rest }?: Partial<TypeMenuContextProps>) => TypeMenuContext;
|
|
199
|
-
/**
|
|
200
|
-
* MenuContext factory, sets the type and the initial object
|
|
201
|
-
*/
|
|
202
|
-
declare const MenuContext: React__default.Context<TypeMenuContext>;
|
|
203
|
-
/**
|
|
204
|
-
* Provider Component sets the context values into the provider
|
|
205
|
-
*/
|
|
206
|
-
declare const MenuProvider: ({ children, menuProps, }: TypeMenuProviderProps) => react_jsx_runtime.JSX.Element;
|
|
207
|
-
/**
|
|
208
|
-
* Utility hook for consuming MenuContext
|
|
209
|
-
*/
|
|
210
|
-
declare const useMenuContext: () => TypeMenuContext;
|
|
211
|
-
|
|
212
|
-
interface TypeMenuRootOwnProps {
|
|
213
|
-
menuToggleElement: React__default.ReactElement<any>;
|
|
214
|
-
popoutProps?: Partial<Omit<TypePopoutProps, "isOpen" | "setIsOpen" | "content" | "children">>;
|
|
215
|
-
width?: TypePopoutProps["width"];
|
|
216
|
-
}
|
|
217
|
-
interface TypeMenuRootProps extends Partial<TypeMenuProviderProps["menuProps"]>, Pick<TypeMenuProviderProps, "children">, TypeMenuRootOwnProps {
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* @link https://seeds.sproutsocial.com/components/menu-root/
|
|
221
|
-
*
|
|
222
|
-
* @description MenuRoot is a utility component used to handle {@link https://github.com/sproutsocial/seeds/blob/dev/seeds-react/seeds-react-menu/src/MenuContext.tsx | MenuContext}. This component should rarely, if ever, be used directly unless building a custom menu type.
|
|
223
|
-
*/
|
|
224
|
-
declare const MenuRoot: ({ children, menuToggleElement, popoutProps: { focusLockProps, ...popoutProps }, width, ...contextProps }: TypeMenuRootProps) => react_jsx_runtime.JSX.Element;
|
|
225
|
-
|
|
226
242
|
declare const MenuLabel: ({ children, ...rest }: Partial<TypeLabelProps>) => react_jsx_runtime.JSX.Element;
|
|
227
243
|
|
|
228
244
|
interface TypeMenuToggleButtonProps extends Partial<TypeButtonProps> {
|
|
@@ -230,10 +246,10 @@ interface TypeMenuToggleButtonProps extends Partial<TypeButtonProps> {
|
|
|
230
246
|
}
|
|
231
247
|
declare const MenuToggleButton: ({ children, ...rest }: TypeMenuToggleButtonProps) => react_jsx_runtime.JSX.Element;
|
|
232
248
|
|
|
233
|
-
type TypeInvalidMenuProps = "initialSelectedItem" | "defaultSelectedItem" | "selectedItem";
|
|
234
|
-
interface
|
|
235
|
-
children: TypeMenuRootProps["children"];
|
|
249
|
+
type TypeInvalidMenuProps = "initialSelectedItem" | "defaultSelectedItem" | "selectedItem" | "items";
|
|
250
|
+
interface TypeActionMenuBaseProps extends TypeMenuRootOwnProps, Omit<TypeDownshiftSelectProps, TypeInvalidMenuProps> {
|
|
236
251
|
}
|
|
252
|
+
type TypeActionMenuProps = TypeActionMenuBaseProps & TypeChildrenOrItems;
|
|
237
253
|
|
|
238
254
|
/**
|
|
239
255
|
* @link https://seeds.sproutsocial.com/components/action-menu/
|
|
@@ -244,11 +260,11 @@ interface TypeActionMenuProps extends TypeMenuRootOwnProps, Omit<TypeDownshiftSe
|
|
|
244
260
|
* @see {@link https://github.com/sproutsocial/seeds/tree/dev/seeds-react/seeds-react-menu/src/SingleSelectMenu | SingleSelectMenu}
|
|
245
261
|
* @see {@link https://github.com/sproutsocial/seeds/tree/dev/seeds-react/seeds-react-menu/src/MultiSelectMenu | MultiSelectMenu}
|
|
246
262
|
*/
|
|
247
|
-
declare const ActionMenu: ({ children, stateReducer: externalStateReducer, ...useSelectProps }: TypeActionMenuProps) => react_jsx_runtime.JSX.Element;
|
|
263
|
+
declare const ActionMenu: ({ children: childrenProp, items, MenuItemComponent, stateReducer: externalStateReducer, ...useSelectProps }: TypeActionMenuProps) => react_jsx_runtime.JSX.Element;
|
|
248
264
|
|
|
249
|
-
interface
|
|
250
|
-
children: TypeMenuRootProps["children"];
|
|
265
|
+
interface TypeSingleSelectMenuBaseProps extends TypeMenuRootOwnProps, Omit<TypeDownshiftSelectProps, "items"> {
|
|
251
266
|
}
|
|
267
|
+
type TypeSingleSelectMenuProps = TypeSingleSelectMenuBaseProps & TypeChildrenOrItems;
|
|
252
268
|
|
|
253
269
|
/**
|
|
254
270
|
* @link https://seeds.sproutsocial.com/components/singleselect-menu/
|
|
@@ -258,11 +274,11 @@ interface TypeSingleSelectMenuProps extends TypeMenuRootOwnProps, TypeDownshiftS
|
|
|
258
274
|
* **To trigger actions from a menu:**
|
|
259
275
|
* @see {@link https://github.com/sproutsocial/seeds/tree/dev/seeds-react/seeds-react-menu/src/ActionMenu | ActionMenu}
|
|
260
276
|
*/
|
|
261
|
-
declare const SingleSelectMenu: ({ children, stateReducer: externalStateReducer, ...useSelectProps }: TypeSingleSelectMenuProps) => react_jsx_runtime.JSX.Element;
|
|
277
|
+
declare const SingleSelectMenu: ({ children: childrenProp, stateReducer: externalStateReducer, items, MenuItemComponent, ...useSelectProps }: TypeSingleSelectMenuProps) => react_jsx_runtime.JSX.Element;
|
|
262
278
|
|
|
263
|
-
interface
|
|
264
|
-
children: TypeMenuRootProps["children"];
|
|
279
|
+
interface TypeMultiSelectMenuBaseProps extends TypeMenuRootOwnProps, Omit<TypeDownshiftSelectProps, "items">, Omit<TypeDownshiftMultiSelectProps, "items"> {
|
|
265
280
|
}
|
|
281
|
+
type TypeMultiSelectMenuProps = TypeMultiSelectMenuBaseProps & TypeChildrenOrItems;
|
|
266
282
|
|
|
267
283
|
/**
|
|
268
284
|
* @link https://seeds.sproutsocial.com/components/multiselect-menu/
|
|
@@ -271,12 +287,12 @@ interface TypeMultiSelectMenuProps extends TypeMenuRootOwnProps, TypeDownshiftSe
|
|
|
271
287
|
*
|
|
272
288
|
* @see {@link https://seeds.sproutsocial.com/components/menu-group/ | MenuGroup}
|
|
273
289
|
*/
|
|
274
|
-
declare const MultiSelectMenu: ({ children, stateReducer: externalStateReducer, getA11yMultiStatusMessage, onMultiSelectStateChange, multiSelectStateReducer, ...useSelectProps }: TypeMultiSelectMenuProps) => react_jsx_runtime.JSX.Element;
|
|
290
|
+
declare const MultiSelectMenu: ({ children: childrenProp, items, MenuItemComponent, stateReducer: externalStateReducer, getA11yMultiStatusMessage, onMultiSelectStateChange, multiSelectStateReducer, ...useSelectProps }: TypeMultiSelectMenuProps) => react_jsx_runtime.JSX.Element;
|
|
275
291
|
|
|
276
|
-
interface
|
|
277
|
-
children: TypeMenuRootProps["children"];
|
|
292
|
+
interface TypeAutocompleteBaseProps extends TypeMenuRootOwnProps, Omit<TypeDownshiftComboboxProps, "items"> {
|
|
278
293
|
getIsItemVisible?: (item: TypeMenuContext["items"][number], inputValue: string) => boolean;
|
|
279
294
|
}
|
|
295
|
+
type TypeAutocompleteProps = TypeAutocompleteBaseProps & TypeChildrenOrItems;
|
|
280
296
|
|
|
281
297
|
/**
|
|
282
298
|
* @link https://seeds.sproutsocial.com/components/multiselect-menu/
|
|
@@ -285,27 +301,36 @@ interface TypeAutocompleteProps extends TypeMenuRootOwnProps, TypeDownshiftCombo
|
|
|
285
301
|
*
|
|
286
302
|
* @see {@link https://seeds.sproutsocial.com/components/menu-group/ | MenuGroup}
|
|
287
303
|
*/
|
|
288
|
-
declare const Autocomplete: ({ children, stateReducer: externalStateReducer, itemToString, getIsItemVisible, ...useComboboxProps }: TypeAutocompleteProps) => react_jsx_runtime.JSX.Element;
|
|
304
|
+
declare const Autocomplete: ({ children: childrenProp, stateReducer: externalStateReducer, items: itemsProp, MenuItemComponent, itemToString, getIsItemVisible, ...useComboboxProps }: TypeAutocompleteProps) => react_jsx_runtime.JSX.Element;
|
|
289
305
|
|
|
290
306
|
type TypeInputEventListeners = "onKeyDown" | "onChange" | "onInput" | "onBlur" | "onClick" | "refKey";
|
|
291
307
|
interface TypeAutocompleteInputProps extends Pick<UseComboboxGetInputPropsOptions, TypeInputEventListeners>, Omit<Partial<TypeInputProps>, TypeInputEventListeners> {
|
|
292
308
|
}
|
|
293
309
|
declare const AutocompleteInput: ({ onKeyDown, onChange, onInput, onBlur, onClick, inputProps, ...rest }: TypeAutocompleteInputProps) => react_jsx_runtime.JSX.Element;
|
|
294
310
|
|
|
295
|
-
interface
|
|
296
|
-
children
|
|
311
|
+
interface TypeUseMenuChildrenProps {
|
|
312
|
+
children?: ReactNode;
|
|
313
|
+
items?: TypeMenuItemProps[];
|
|
314
|
+
MenuItemComponent?: React__default.ComponentType<TypeMenuItemProps>;
|
|
315
|
+
}
|
|
316
|
+
interface TypeMapMenuItemsProps {
|
|
317
|
+
items: TypeMenuItemProps[];
|
|
318
|
+
MenuItemComponent: React__default.ComponentType<TypeMenuItemProps>;
|
|
297
319
|
}
|
|
298
320
|
type TypeItemElement = React__default.ReactElement<TypeMenuItemProps>;
|
|
299
321
|
type TypeMenuGroupElement = React__default.ReactElement<TypeMenuGroupProps>;
|
|
322
|
+
type TypeMenuContentElement = React__default.ReactElement<TypeMenuContentProps>;
|
|
300
323
|
interface TypeMenuChildren {
|
|
301
|
-
type: "item" | "group";
|
|
302
|
-
element: React__default.ReactElement<TypeMenuGroupProps> | React__default.ReactElement<TypeMenuItemProps>;
|
|
324
|
+
type: "item" | "group" | "content";
|
|
325
|
+
element: React__default.ReactElement<TypeMenuGroupProps> | React__default.ReactElement<TypeMenuItemProps> | React__default.ReactElement<TypeMenuContentProps>;
|
|
303
326
|
}
|
|
304
|
-
declare const
|
|
327
|
+
declare const mapMenuItems: ({ items, MenuItemComponent, }: TypeMapMenuItemsProps) => react_jsx_runtime.JSX.Element;
|
|
328
|
+
declare const useMenuChildren: ({ children: childrenProp, items, MenuItemComponent, }: TypeUseMenuChildrenProps) => {
|
|
305
329
|
allMenuItems: TypeDefaultItemProps[];
|
|
306
330
|
menuItemsMap: {
|
|
307
331
|
[key: string]: TypeDefaultItemProps;
|
|
308
332
|
};
|
|
333
|
+
children: TypeNotEmptyChildren;
|
|
309
334
|
};
|
|
310
335
|
|
|
311
336
|
declare const useSelectStateReducer: Required<UseSelectProps<TypeDefaultItemProps>>["stateReducer"];
|
|
@@ -314,4 +339,4 @@ declare const defaultUseSelectProps: {
|
|
|
314
339
|
isItemDisabled: (item: any) => boolean;
|
|
315
340
|
};
|
|
316
341
|
|
|
317
|
-
export { ActionMenu, Autocomplete, AutocompleteInput, INPUT_TYPES, type InputType, MenuContent, MenuContext, MenuFooter, MenuGroup, MenuHeader, MenuItem, MenuItemAction, MenuItemContainer, MenuItemRow, MenuItemText, MenuLabel, MenuProvider, MenuRoot, MenuToggleButton, MultiSelectMenu, SingleSelectMenu, StyledMenuGroup, StyledMenuGroupUl, StyledMenuItem, StyledTitle, type TypeActionMenuProps, type TypeAutocompleteInputProps, type TypeAutocompleteProps, type TypeDefaultItemProps, type TypeDownshiftComboboxProps, type TypeDownshiftComboboxReturnValue, type TypeDownshiftMultiSelectProps, type TypeDownshiftMultiSelectReturnValue, type TypeDownshiftSelectProps, type TypeDownshiftSelectReturnValue, type TypeItemElement, type TypeMenuChildren, type TypeMenuContentProps, type TypeMenuContext, type TypeMenuContextProps, type TypeMenuGroupElement, type TypeMenuGroupProps, type TypeMenuGroupStyledProps, type TypeMenuHeaderProps, type TypeMenuItemProps, type TypeMenuItemStyledProps, type TypeMenuProviderProps, type TypeMenuRootOwnProps, type TypeMenuRootProps, type TypeMenuToggleButtonProps, type TypeMultiSelectMenuProps, type TypeNotEmptyChildren, type TypeSingleSelectMenuProps, type
|
|
342
|
+
export { ActionMenu, Autocomplete, AutocompleteInput, INPUT_TYPES, type InputType, MenuContent, MenuContext, MenuFooter, MenuGroup, MenuHeader, MenuItem, MenuItemAction, MenuItemContainer, MenuItemRow, MenuItemText, MenuLabel, MenuProvider, MenuRoot, MenuToggleButton, MultiSelectMenu, SingleSelectMenu, StyledMenuGroup, StyledMenuGroupUl, StyledMenuItem, StyledTitle, type TypeActionMenuProps, type TypeAutocompleteInputProps, type TypeAutocompleteProps, type TypeChildrenOrItems, type TypeDefaultItemProps, type TypeDownshiftComboboxProps, type TypeDownshiftComboboxReturnValue, type TypeDownshiftMultiSelectProps, type TypeDownshiftMultiSelectReturnValue, type TypeDownshiftSelectProps, type TypeDownshiftSelectReturnValue, type TypeItemElement, type TypeMapMenuItemsProps, type TypeMenuChildren, type TypeMenuContentElement, type TypeMenuContentProps, type TypeMenuContext, type TypeMenuContextProps, type TypeMenuGroupElement, type TypeMenuGroupProps, type TypeMenuGroupStyledProps, type TypeMenuHeaderProps, type TypeMenuItemProps, type TypeMenuItemStyledProps, type TypeMenuProviderProps, type TypeMenuRootOwnProps, type TypeMenuRootProps, type TypeMenuToggleButtonProps, type TypeMultiSelectMenuProps, type TypeNotEmptyChildren, type TypeSingleSelectMenuProps, type TypeUseMenuChildrenProps, defaultUseSelectProps, mapMenuItems, useMenu, useMenuChildren, useMenuContext, useSelectStateReducer };
|