@sproutsocial/seeds-react-menu 0.5.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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +15 -0
- package/dist/esm/index.js +1486 -440
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +248 -92
- package/dist/index.d.ts +248 -92
- package/dist/index.js +1500 -429
- package/dist/index.js.map +1 -1
- package/package.json +4 -1
- package/src/ActionMenu/ActionMenu.stories.tsx +426 -0
- package/src/ActionMenu/ActionMenu.tsx +24 -27
- package/src/ActionMenu/ActionMenuTypes.ts +8 -7
- package/src/ActionMenu/__tests__/ActionMenu.test.tsx +17 -8
- package/src/ActionMenu/__tests__/ActionMenu.typetest.tsx +8 -8
- package/src/Autocomplete/Autocomplete.stories.tsx +38 -3
- package/src/Autocomplete/Autocomplete.tsx +15 -80
- package/src/Autocomplete/AutocompleteInput.tsx +18 -27
- package/src/Autocomplete/AutocompleteTokenInput.tsx +50 -0
- package/src/Autocomplete/AutocompleteTypes.ts +25 -12
- package/src/Autocomplete/MultiAutocomplete.tsx +189 -0
- package/src/Autocomplete/SingleAutocomplete.tsx +74 -0
- package/src/Autocomplete/__tests__/Autocomplete.test.tsx +171 -3
- package/src/Autocomplete/__tests__/Autocomplete.typetest.tsx +90 -8
- package/src/MenuContent/MenuContent.stories.tsx +164 -0
- package/src/MenuContent/MenuContent.tsx +26 -12
- package/src/MenuContent/MenuContentTypes.ts +6 -4
- package/src/MenuContent/__tests__/MenuContent.typetest.tsx +8 -8
- package/src/MenuContext.tsx +191 -37
- package/src/MenuFooter/MenuFooter.stories.tsx +202 -0
- package/src/MenuFooter/__tests__/MenuFooter.test.tsx +16 -11
- package/src/MenuGroup/MenuGroup.feature +16 -16
- package/src/MenuGroup/MenuGroup.stories.tsx +248 -0
- package/src/MenuGroup/MenuGroup.tsx +8 -7
- package/src/MenuGroup/MenuGroupTypes.ts +6 -2
- package/src/MenuGroup/__tests__/MenuGroup.test.tsx +6 -6
- package/src/MenuGroup/__tests__/MenuGroup.typetest.tsx +7 -7
- package/src/MenuGroup/styles.tsx +4 -2
- package/src/MenuHeader/MenuHeader.stories.tsx +276 -0
- package/src/MenuHeader/MenuHeader.tsx +3 -1
- package/src/MenuHeader/__tests__/MenuHeader.test.tsx +23 -13
- package/src/MenuHeader/styles.tsx +18 -14
- package/src/MenuItem/MenuItem.stories.tsx +507 -0
- package/src/MenuItem/MenuItem.tsx +18 -8
- package/src/MenuItem/MenuItemTypes.ts +9 -4
- package/src/MenuItem/__tests__/MenuItem.test.tsx +6 -6
- package/src/MenuItem/styles.tsx +21 -5
- package/src/MenuItem/useOptionProps.tsx +10 -8
- package/src/MenuLabel.tsx +2 -2
- package/src/MenuRoot/MenuRoot.tsx +37 -23
- package/src/MenuRoot/__tests__/MenuRoot.test.tsx +59 -32
- package/src/MenuSearchInput/MenuSearchInput.tsx +63 -0
- package/src/MenuSearchInput/__tests__/MenuSearchInput.test.tsx +157 -0
- package/src/MenuSearchInput/__tests__/MenuSearchInput.typetest.tsx +31 -0
- package/src/MenuSearchInput/index.ts +1 -0
- package/src/MenuSearchTokenInput/MenuSearchTokenInput.tsx +98 -0
- package/src/MenuSearchTokenInput/__tests__/MenuSearchTokenInput.test.tsx +247 -0
- package/src/MenuSearchTokenInput/__tests__/MenuSearchTokenInput.typetest.tsx +33 -0
- package/src/MenuSearchTokenInput/index.ts +1 -0
- package/src/MenuToggleButton/MenuToggleButton.stories.tsx +72 -0
- package/src/{MenuToggleButton.tsx → MenuToggleButton/MenuToggleButton.tsx} +6 -5
- package/src/MenuToggleButton/index.ts +1 -0
- package/src/MenuTokenInput.tsx +104 -0
- package/src/MultiSelectMenu/MultiSelectMenu.stories.tsx +214 -0
- package/src/MultiSelectMenu/MultiSelectMenu.tsx +38 -68
- package/src/MultiSelectMenu/MultiSelectMenuTypes.ts +8 -6
- package/src/MultiSelectMenu/__tests__/MultiSelectMenu.test.tsx +46 -17
- package/src/MultiSelectMenu/__tests__/MultiSelectMenu.typetest.tsx +6 -6
- package/src/NestedMenu/NestedMenu.feature +109 -0
- package/src/NestedMenu/NestedMenu.stories.tsx +157 -0
- package/src/NestedMenu/NestedMenu.tsx +102 -0
- package/src/NestedMenu/NestedMenuContent.tsx +71 -0
- package/src/NestedMenu/NestedMenuContext.tsx +56 -0
- package/src/NestedMenu/NestedMenuHeader.tsx +25 -0
- package/src/NestedMenu/NestedMenuItem.tsx +37 -0
- package/src/NestedMenu/NestedMenuTypes.ts +47 -0
- package/src/NestedMenu/__tests__/NestedMenu.test.tsx +31 -0
- package/src/NestedMenu/__tests__/NestedMenu.typetest.tsx +134 -0
- package/src/NestedMenu/index.ts +5 -0
- package/src/SingleSelectMenu/SingleSelectMenu.stories.tsx +227 -0
- package/src/SingleSelectMenu/SingleSelectMenu.tsx +23 -26
- package/src/SingleSelectMenu/SingleSelectMenuTypes.ts +7 -5
- package/src/SingleSelectMenu/__tests__/SingleSelectMenu.typetest.tsx +6 -6
- package/src/SubmenuItem/SubmenuItem.feature +82 -0
- package/src/SubmenuItem/SubmenuItem.stories.tsx +163 -0
- package/src/SubmenuItem/SubmenuItem.tsx +254 -0
- package/src/SubmenuItem/SubmenuItemTypes.ts +24 -0
- package/src/SubmenuItem/__tests__/SubmenuItem.test.tsx +3 -0
- package/src/SubmenuItem/__tests__/SubmenuItem.typetest.tsx +112 -0
- package/src/SubmenuItem/index.ts +2 -0
- package/src/hooks/useDownshiftDefaults.tsx +107 -0
- package/src/hooks/useItemFiltering.tsx +66 -0
- package/src/hooks/useMenuChildren.tsx +197 -128
- package/src/index.ts +6 -0
- package/src/menuTestingUtils.tsx +21 -10
- package/src/reducers/nestedMenuStateReducer.tsx +23 -0
- package/src/reducers/useComboboxStateReducer.tsx +26 -8
- package/src/reducers/useSelectStateReducer.tsx +24 -6
- package/src/storybookUtilities/menu-storybook-components.tsx +5 -3
- package/src/types.ts +38 -30
- package/src/utils/downshiftDefaults.ts +9 -0
- package/src/utils/getMultiSelectOverrides.ts +21 -0
- package/src/utils/reduceReducers.ts +19 -0
- package/src/utils/itemToString.ts +0 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import
|
|
3
|
-
import { UseComboboxProps, UseSelectProps, UseMultipleSelectionProps, UseComboboxReturnValue, UseSelectReturnValue, UseMultipleSelectionReturnValue, GetItemPropsOptions, UseComboboxGetInputPropsOptions } from 'downshift';
|
|
2
|
+
import { UseComboboxProps, UseSelectProps, UseMultipleSelectionProps, UseComboboxReturnValue, UseSelectReturnValue, UseMultipleSelectionReturnValue, UseComboboxGetInputPropsOptions, GetItemPropsOptions } from 'downshift';
|
|
4
3
|
import { TypeBorderSystemProps, TypeColorSystemProps, TypeFlexboxSystemProps, TypeGridSystemProps, TypeLayoutSystemProps, TypePositionSystemProps, TypeSpaceSystemProps, TypeTypographySystemProps, TypeStyledComponentsCommonProps } from '@sproutsocial/seeds-react-system-props';
|
|
5
4
|
import * as React$1 from 'react';
|
|
6
5
|
import React__default, { ReactNode } from 'react';
|
|
7
6
|
import { TypePopoutProps } from '@sproutsocial/seeds-react-popout';
|
|
7
|
+
import { TypeTokenInputProps, TypeTokenSpec } from '@sproutsocial/seeds-react-token-input';
|
|
8
8
|
import * as styled_components from 'styled-components';
|
|
9
9
|
import { HTMLMotionProps } from 'motion/react';
|
|
10
10
|
import { TypeBoxProps } from '@sproutsocial/seeds-react-box';
|
|
@@ -25,13 +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 TypeMenuGroupBaseProps extends TypeMenuGroupStyledProps, Omit<React.ComponentPropsWithoutRef<"ul">, "color"> {
|
|
29
29
|
id: string;
|
|
30
30
|
isSingleSelect?: boolean;
|
|
31
31
|
title?: string;
|
|
32
32
|
titleAs?: string | React.ComponentType<any>;
|
|
33
33
|
}
|
|
34
|
-
type TypeMenuGroupProps =
|
|
34
|
+
type TypeMenuGroupProps<I extends TypeMenuItemProps = TypeMenuItemProps> = TypeMenuGroupBaseProps & TypeChildrenOrItems<I>;
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* @link https://seeds.sproutsocial.com/components/menu-group/
|
|
@@ -52,35 +52,41 @@ type TypeMenuGroupProps = TypeBaseMenuGroupProps & TypeChildrenOrItems;
|
|
|
52
52
|
*
|
|
53
53
|
* @see {@link https://seeds.sproutsocial.com/components/menu-item/ | MenuItem}
|
|
54
54
|
*/
|
|
55
|
-
declare const MenuGroup: ({ titleAs, children: childrenProp, title, color, isSingleSelect, id,
|
|
55
|
+
declare const MenuGroup: <I extends TypeMenuItemProps = TypeMenuItemProps>({ titleAs, children: childrenProp, title, color, isSingleSelect, id, menuItems, MenuItemComponent, ...rest }: TypeMenuGroupProps<I>) => react_jsx_runtime.JSX.Element | null;
|
|
56
56
|
|
|
57
|
-
declare const StyledMenuGroup: styled_components.StyledComponent<"li", styled_components.DefaultTheme,
|
|
57
|
+
declare const StyledMenuGroup: styled_components.StyledComponent<"li", styled_components.DefaultTheme, TypeMenuGroupBaseProps, never>;
|
|
58
58
|
declare const StyledTitle: styled_components.StyledComponent<React$1.FC<_sproutsocial_seeds_react_text.TypeTextProps>, styled_components.DefaultTheme, {}, never>;
|
|
59
59
|
declare const StyledMenuGroupUl: styled_components.StyledComponent<"ul", styled_components.DefaultTheme, {}, never>;
|
|
60
60
|
|
|
61
|
-
interface TypeDownshiftComboboxProps extends Partial<UseComboboxProps<
|
|
61
|
+
interface TypeDownshiftComboboxProps extends Partial<UseComboboxProps<TypeInternalItemProps>> {
|
|
62
62
|
}
|
|
63
|
-
interface TypeDownshiftSelectProps extends Partial<UseSelectProps<
|
|
63
|
+
interface TypeDownshiftSelectProps extends Partial<UseSelectProps<TypeInternalItemProps>> {
|
|
64
64
|
}
|
|
65
|
-
interface TypeDownshiftMultiSelectProps extends Partial<Omit<UseMultipleSelectionProps<
|
|
66
|
-
getA11yMultiStatusMessage?: UseMultipleSelectionProps<
|
|
67
|
-
onMultiSelectStateChange?: UseMultipleSelectionProps<
|
|
68
|
-
multiSelectStateReducer?: UseMultipleSelectionProps<
|
|
65
|
+
interface TypeDownshiftMultiSelectProps extends Partial<Omit<UseMultipleSelectionProps<TypeInternalItemProps>, "stateReducer" | "onStateChange" | "getA11yStatusMessage">> {
|
|
66
|
+
getA11yMultiStatusMessage?: UseMultipleSelectionProps<TypeInternalItemProps>["getA11yStatusMessage"];
|
|
67
|
+
onMultiSelectStateChange?: UseMultipleSelectionProps<TypeInternalItemProps>["onStateChange"];
|
|
68
|
+
multiSelectStateReducer?: UseMultipleSelectionProps<TypeInternalItemProps>["stateReducer"];
|
|
69
69
|
}
|
|
70
|
-
interface TypeDownshiftComboboxReturnValue extends Partial<UseComboboxReturnValue<
|
|
70
|
+
interface TypeDownshiftComboboxReturnValue extends Partial<UseComboboxReturnValue<TypeInternalItemProps>> {
|
|
71
71
|
}
|
|
72
|
-
interface TypeDownshiftSelectReturnValue extends Partial<UseSelectReturnValue<
|
|
72
|
+
interface TypeDownshiftSelectReturnValue extends Partial<UseSelectReturnValue<TypeInternalItemProps>> {
|
|
73
73
|
}
|
|
74
|
-
interface TypeDownshiftMultiSelectReturnValue extends Partial<UseMultipleSelectionReturnValue<
|
|
74
|
+
interface TypeDownshiftMultiSelectReturnValue extends Partial<UseMultipleSelectionReturnValue<TypeInternalItemProps>> {
|
|
75
75
|
}
|
|
76
76
|
type TypeDonwshiftSharedReturnValue = "getLabelProps" | "getToggleButtonProps" | "getMenuProps";
|
|
77
77
|
type TypeDonwshiftSharedProps = "onHighlightedIndexChange" | "onIsOpenChange" | "onSelectedItemChange" | "onStateChange" | "stateReducer";
|
|
78
|
-
interface
|
|
79
|
-
items: TypeDefaultItemProps[];
|
|
78
|
+
interface TypeMenuContextBaseProps {
|
|
80
79
|
itemsMap?: {
|
|
81
|
-
[key: string]:
|
|
80
|
+
[key: string]: TypeInternalItemProps;
|
|
82
81
|
};
|
|
83
82
|
isListbox?: boolean;
|
|
83
|
+
hiddenItemsMap?: Record<string, boolean>;
|
|
84
|
+
setHiddenItemsMap?: React__default.Dispatch<React__default.SetStateAction<Record<string, boolean>>>;
|
|
85
|
+
subMenuId?: string;
|
|
86
|
+
setSubMenuId?: (id: string) => void;
|
|
87
|
+
contentRef?: React__default.RefObject<HTMLUListElement>;
|
|
88
|
+
}
|
|
89
|
+
interface TypeAllDownshiftProps extends Omit<TypeDownshiftComboboxReturnValue, TypeDonwshiftSharedReturnValue>, Omit<TypeDownshiftComboboxProps, TypeDonwshiftSharedProps>, Omit<TypeDownshiftSelectReturnValue, TypeDonwshiftSharedReturnValue>, Omit<TypeDownshiftSelectProps, TypeDonwshiftSharedProps>, TypeDownshiftMultiSelectReturnValue, TypeDownshiftMultiSelectProps {
|
|
84
90
|
onHighlightedIndexChange?: TypeDownshiftComboboxProps["onHighlightedIndexChange"] | TypeDownshiftSelectProps["onHighlightedIndexChange"];
|
|
85
91
|
onIsOpenChange?: TypeDownshiftComboboxProps["onIsOpenChange"] | TypeDownshiftSelectProps["onIsOpenChange"];
|
|
86
92
|
onSelectedItemChange?: TypeDownshiftComboboxProps["onSelectedItemChange"] | TypeDownshiftSelectProps["onSelectedItemChange"];
|
|
@@ -90,73 +96,116 @@ interface TypeMenuContextProps extends Omit<TypeDownshiftComboboxReturnValue, Ty
|
|
|
90
96
|
getToggleButtonProps?: TypeDownshiftComboboxReturnValue["getToggleButtonProps"] | TypeDownshiftSelectReturnValue["getToggleButtonProps"];
|
|
91
97
|
getMenuProps?: TypeDownshiftComboboxReturnValue["getMenuProps"] | TypeDownshiftSelectReturnValue["getMenuProps"];
|
|
92
98
|
}
|
|
99
|
+
interface TypeMenuContextProps extends TypeAllDownshiftProps, TypeMenuContextBaseProps {
|
|
100
|
+
items: TypeInternalItemProps[];
|
|
101
|
+
itemsMap?: {
|
|
102
|
+
[key: string]: TypeInternalItemProps;
|
|
103
|
+
};
|
|
104
|
+
selectedItemIds?: {
|
|
105
|
+
[key: string]: boolean;
|
|
106
|
+
};
|
|
107
|
+
isListbox?: boolean;
|
|
108
|
+
}
|
|
93
109
|
interface TypeMenuContext extends TypeMenuContextProps {
|
|
94
110
|
itemsMap: {
|
|
95
|
-
[key: string]:
|
|
111
|
+
[key: string]: TypeInternalItemProps;
|
|
96
112
|
};
|
|
113
|
+
isItemSelected: (id: string) => boolean;
|
|
114
|
+
getInputComponentProps: (props: Pick<TypeTokenInputProps, "inputProps"> & Parameters<Required<TypeMenuContextProps>["getInputProps"]>[0]) => Omit<TypeDownshiftMergedInputProps<TypeTokenInputProps>, "onClick">;
|
|
97
115
|
}
|
|
98
116
|
interface TypeMenuProviderProps {
|
|
99
117
|
children: TypeNotEmptyChildren;
|
|
100
|
-
|
|
118
|
+
menuContext: TypeMenuContext;
|
|
119
|
+
}
|
|
120
|
+
interface TypeMenuToggleContext extends TypeMenuContext {
|
|
121
|
+
ref?: (arg0: React__default.ElementRef<any> | HTMLElement) => void;
|
|
122
|
+
toggle?: () => void;
|
|
123
|
+
show?: () => void;
|
|
124
|
+
hide?: () => void;
|
|
125
|
+
ariaProps?: Record<string, any>;
|
|
101
126
|
}
|
|
127
|
+
interface TypeMenuToggleProviderProps extends TypeMenuProviderProps {
|
|
128
|
+
menuContext: TypeMenuToggleContext;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Object for Initializing the Menu Context
|
|
132
|
+
*/
|
|
133
|
+
declare const defaultMenuContext: TypeMenuContext;
|
|
134
|
+
declare const getSelectedItemIds: <T extends TypeMenuContextProps["selectedItems"] | undefined, R = T extends undefined ? undefined : Record<string, boolean>>(selectedItems?: T) => R;
|
|
135
|
+
declare const checkIfItemSelected: ({ id, selectedItem, selectedItemIds, }: {
|
|
136
|
+
id: string;
|
|
137
|
+
selectedItem?: TypeInternalItemProps | null;
|
|
138
|
+
selectedItemIds?: TypeMenuContextProps["selectedItemIds"];
|
|
139
|
+
}) => boolean;
|
|
102
140
|
/**
|
|
103
141
|
* Hook for initializing Menu context
|
|
104
142
|
*/
|
|
105
|
-
declare const useMenu: ({ items, isListbox, isOpen, itemsMap: itemsMapFromProps, ...rest }?: Partial<TypeMenuContextProps>) => TypeMenuContext;
|
|
143
|
+
declare const useMenu: ({ items, isListbox, isOpen, itemsMap: itemsMapFromProps, selectedItemIds: selectedItemIdsFromProps, selectedItem, selectedItems, getInputProps, contentRef: contentRefFromProps, ...rest }?: Partial<TypeMenuContextProps>) => TypeMenuContext;
|
|
106
144
|
/**
|
|
107
|
-
*
|
|
145
|
+
* MenuToggleContext factory, sets the type and the initial object
|
|
146
|
+
* @description Context for the Menu Toggle
|
|
108
147
|
*/
|
|
109
|
-
declare const
|
|
148
|
+
declare const MenuToggleContext: React__default.Context<TypeMenuToggleContext>;
|
|
110
149
|
/**
|
|
111
|
-
*
|
|
150
|
+
* MenuToggleProvider Component sets the context values into the provider
|
|
151
|
+
* @description Context Provider for the Menu Toggle
|
|
112
152
|
*/
|
|
113
|
-
declare const
|
|
153
|
+
declare const MenuToggleProvider: ({ children, menuContext, }: TypeMenuToggleProviderProps) => react_jsx_runtime.JSX.Element;
|
|
114
154
|
/**
|
|
115
|
-
* Utility hook for consuming
|
|
155
|
+
* Utility hook for consuming MenuToggleContext
|
|
116
156
|
*/
|
|
117
|
-
declare const
|
|
157
|
+
declare const useMenuToggleContext: () => TypeMenuToggleContext;
|
|
158
|
+
/**
|
|
159
|
+
* MenuContentContext factory, sets the type and the initial object
|
|
160
|
+
* @description Context for the Menu Content
|
|
161
|
+
*/
|
|
162
|
+
declare const MenuContentContext: React__default.Context<TypeMenuContext>;
|
|
163
|
+
/**
|
|
164
|
+
* MenuContentProvider Component sets the context values into the provider
|
|
165
|
+
* @description Context Provider for the Menu Content
|
|
166
|
+
*/
|
|
167
|
+
declare const MenuContentProvider: ({ children, menuContext, }: TypeMenuProviderProps) => react_jsx_runtime.JSX.Element;
|
|
168
|
+
/**
|
|
169
|
+
* Utility hook for consuming MenuContentContext
|
|
170
|
+
*/
|
|
171
|
+
declare const useMenuContentContext: () => TypeMenuContext;
|
|
118
172
|
|
|
119
173
|
interface TypeMenuRootOwnProps {
|
|
120
174
|
menuToggleElement: React__default.ReactElement<any>;
|
|
121
175
|
popoutProps?: Partial<Omit<TypePopoutProps, "isOpen" | "setIsOpen" | "content" | "children">>;
|
|
122
176
|
width?: TypePopoutProps["width"];
|
|
123
177
|
}
|
|
124
|
-
interface TypeMenuRootProps extends Partial<
|
|
178
|
+
interface TypeMenuRootProps extends Partial<TypeMenuContextProps>, Pick<TypeMenuProviderProps, "children">, TypeMenuRootOwnProps {
|
|
125
179
|
}
|
|
126
180
|
/**
|
|
127
181
|
* @link https://seeds.sproutsocial.com/components/menu-root/
|
|
128
182
|
*
|
|
129
183
|
* @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
184
|
*/
|
|
131
|
-
declare const MenuRoot: ({ children, menuToggleElement, popoutProps: { focusLockProps, ...popoutProps }, width, ...contextProps }: TypeMenuRootProps) => react_jsx_runtime.JSX.Element;
|
|
185
|
+
declare const MenuRoot: ({ children, menuToggleElement, popoutProps: { placement, focusLockProps, ...popoutProps }, width, ...contextProps }: TypeMenuRootProps) => react_jsx_runtime.JSX.Element;
|
|
132
186
|
|
|
133
|
-
interface
|
|
187
|
+
interface TypeInternalItemProps<Item = TypeMenuItemProps> {
|
|
134
188
|
id: string;
|
|
135
189
|
index: number;
|
|
136
190
|
disabled?: boolean;
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
menuGroupProps?: TypeMenuGroupProps;
|
|
191
|
+
menuItemProps?: Item;
|
|
192
|
+
menuGroupProps?: TypeMenuGroupBaseProps;
|
|
140
193
|
}
|
|
141
|
-
type
|
|
194
|
+
type TypeChildrenOrItems<I extends TypeMenuItemProps = TypeMenuItemProps> = {
|
|
142
195
|
/** 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
196
|
children: TypeMenuRootProps["children"];
|
|
151
|
-
|
|
197
|
+
menuItems?: never;
|
|
152
198
|
MenuItemComponent?: never;
|
|
153
|
-
}
|
|
154
|
-
type TypePropsWithItems = {
|
|
199
|
+
} | {
|
|
155
200
|
children?: never;
|
|
156
|
-
items
|
|
201
|
+
/** Allows menu items to be passed in as objects. Cannot be used with the children prop.*/
|
|
202
|
+
menuItems: I[];
|
|
203
|
+
/** Allows a custom MenuItem component to be used when rendering using the items prop.*/
|
|
204
|
+
MenuItemComponent?: React.ComponentType<I>;
|
|
157
205
|
};
|
|
158
|
-
type TypeChildrenOrItems = TypeBaseChildrenOrItems & (TypePropsWithChildren | TypePropsWithItems);
|
|
159
206
|
type TypeNotEmptyChildren = React.ReactChild | React.ReactFragment | React.ReactPortal;
|
|
207
|
+
type TypeInputEventListeners = "onKeyDown" | "onChange" | "onInput" | "onBlur" | "onClick" | "refKey";
|
|
208
|
+
type TypeDownshiftMergedInputProps<B> = Pick<UseComboboxGetInputPropsOptions, TypeInputEventListeners> & Omit<Partial<B>, TypeInputEventListeners>;
|
|
160
209
|
|
|
161
210
|
interface TypeMenuItemStyledProps extends TypeBorderSystemProps, TypeColorSystemProps, TypeFlexboxSystemProps, TypeGridSystemProps, TypeLayoutSystemProps, TypePositionSystemProps, TypeSpaceSystemProps, TypeTypographySystemProps {
|
|
162
211
|
}
|
|
@@ -167,24 +216,28 @@ declare const INPUT_TYPES: {
|
|
|
167
216
|
readonly ICON: "icon";
|
|
168
217
|
};
|
|
169
218
|
type InputType = (typeof INPUT_TYPES)[keyof typeof INPUT_TYPES];
|
|
170
|
-
interface TypeMenuItemProps extends TypeMenuItemStyledProps, Omit<GetItemPropsOptions<
|
|
219
|
+
interface TypeMenuItemProps extends TypeMenuItemStyledProps, Omit<GetItemPropsOptions<TypeInternalItemProps>, "as" | "item" | "ref" | keyof TypeMenuItemStyledProps | keyof TypeInternalItemProps>, Omit<TypeInternalItemProps, "index"> {
|
|
171
220
|
children: React.ReactNode;
|
|
172
221
|
disabled?: boolean;
|
|
173
222
|
role?: TypeMenuItemRoles;
|
|
223
|
+
innerRef?: React.Ref<any>;
|
|
174
224
|
$highlighted?: boolean;
|
|
175
225
|
active?: boolean;
|
|
176
226
|
inputType?: InputType;
|
|
177
227
|
inputLabelId?: string;
|
|
178
228
|
}
|
|
179
229
|
|
|
180
|
-
declare const MenuItem: ({ id, children, onClick, onKeyDown, disabled,
|
|
230
|
+
declare const MenuItem: ({ id, children, onClick, onKeyDown, disabled, active, innerRef, href, color, ...props }: TypeMenuItemProps) => react_jsx_runtime.JSX.Element;
|
|
181
231
|
|
|
182
232
|
declare const MenuItemContainer: styled_components.StyledComponent<"li", styled_components.DefaultTheme, {}, never>;
|
|
183
|
-
declare const StyledMenuItem: styled_components.StyledComponent<"
|
|
233
|
+
declare const StyledMenuItem: styled_components.StyledComponent<"button", styled_components.DefaultTheme, {
|
|
184
234
|
$highlighted: boolean;
|
|
235
|
+
$active?: boolean;
|
|
185
236
|
}, never>;
|
|
186
237
|
declare const MenuItemRow: styled_components.StyledComponent<"div", styled_components.DefaultTheme, {}, never>;
|
|
187
238
|
declare const MenuItemAction: styled_components.StyledComponent<"div", styled_components.DefaultTheme, {}, never>;
|
|
239
|
+
declare const MenuItemActionLeft: styled_components.StyledComponent<"div", styled_components.DefaultTheme, {}, never>;
|
|
240
|
+
declare const MenuItemActionRight: styled_components.StyledComponent<"div", styled_components.DefaultTheme, {}, never>;
|
|
188
241
|
declare const MenuItemText: styled_components.StyledComponent<"div", styled_components.DefaultTheme, {}, never>;
|
|
189
242
|
|
|
190
243
|
interface TypeMenuHeaderProps extends Omit<React$1.ComponentPropsWithoutRef<"div">, "color">, TypeStyledComponentsCommonProps, TypeBorderSystemProps, TypeColorSystemProps, TypeFlexboxSystemProps, TypeGridSystemProps, TypeLayoutSystemProps, TypeSpaceSystemProps, TypePositionSystemProps {
|
|
@@ -202,9 +255,9 @@ interface TypeMenuHeaderProps extends Omit<React$1.ComponentPropsWithoutRef<"div
|
|
|
202
255
|
*/
|
|
203
256
|
declare const MenuHeader: ({ children, title, leftAction, rightAction, ...rest }: TypeMenuHeaderProps) => react_jsx_runtime.JSX.Element;
|
|
204
257
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
258
|
+
type TypeMenuContentProps<I extends TypeMenuItemProps = TypeMenuItemProps> = Omit<HTMLMotionProps<"ul">, "children"> & {
|
|
259
|
+
innerRef?: React.Ref<HTMLUListElement>;
|
|
260
|
+
} & TypeChildrenOrItems<I>;
|
|
208
261
|
|
|
209
262
|
/**
|
|
210
263
|
* @link https://seeds.sproutsocial.com/components/menu-content/
|
|
@@ -228,7 +281,7 @@ type TypeMenuContentProps = TypeMenuContentBaseProps & TypeChildrenOrItems;
|
|
|
228
281
|
* @see {@link https://seeds.sproutsocial.com/components/menu-item/ | MenuItem}
|
|
229
282
|
* @see {@link https://seeds.sproutsocial.com/components/menu-group/ | MenuGroup}
|
|
230
283
|
*/
|
|
231
|
-
declare const MenuContent: ({ id, children: childrenProp,
|
|
284
|
+
declare const MenuContent: <I extends TypeMenuItemProps = TypeMenuItemProps>({ id, children: childrenProp, menuItems, MenuItemComponent, onKeyDown, innerRef, ...rest }: TypeMenuContentProps<I>) => react_jsx_runtime.JSX.Element | null;
|
|
232
285
|
|
|
233
286
|
/**
|
|
234
287
|
* @link https://seeds.sproutsocial.com/components/menu-footer/
|
|
@@ -246,10 +299,38 @@ interface TypeMenuToggleButtonProps extends Partial<TypeButtonProps> {
|
|
|
246
299
|
}
|
|
247
300
|
declare const MenuToggleButton: ({ children, ...rest }: TypeMenuToggleButtonProps) => react_jsx_runtime.JSX.Element;
|
|
248
301
|
|
|
249
|
-
type
|
|
302
|
+
type TypeGetIsItemVisibleFn = (item: TypeMenuContext["items"][number], inputValue: string) => boolean;
|
|
303
|
+
|
|
304
|
+
interface TypeMenuSearchInputProps extends TypeInputProps {
|
|
305
|
+
getIsItemVisible?: TypeGetIsItemVisibleFn;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* @link https://seeds.sproutsocial.com/components/menu-header/
|
|
309
|
+
*
|
|
310
|
+
* @description MenuSearchInput is search input that can be added to the MenuHeader to filter the items.
|
|
311
|
+
*/
|
|
312
|
+
declare const MenuSearchInput: ({ getIsItemVisible, ...inputProps }: TypeMenuSearchInputProps) => react_jsx_runtime.JSX.Element;
|
|
313
|
+
|
|
314
|
+
interface TypeMenuTokenInputProps extends TypeTokenInputProps {
|
|
315
|
+
getTokenProps?: (itemId: TypeInternalItemProps["id"]) => Partial<TypeTokenSpec>;
|
|
316
|
+
MenuContext?: typeof MenuToggleContext | typeof MenuContentContext;
|
|
317
|
+
}
|
|
318
|
+
declare const MenuTokenInput: ({ inputProps, getTokenProps, onKeyDown, MenuContext, ...tokenInputProps }: TypeMenuTokenInputProps) => react_jsx_runtime.JSX.Element;
|
|
319
|
+
|
|
320
|
+
interface TypeMenuSearchTokenInputProps extends TypeMenuTokenInputProps {
|
|
321
|
+
getIsItemVisible?: TypeGetIsItemVisibleFn;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* @link https://seeds.sproutsocial.com/components/menu-search-token-input/
|
|
325
|
+
*
|
|
326
|
+
* @description MenuSearchTokenInput is search token input that can be added to the MenuHeader to filter the items.
|
|
327
|
+
*/
|
|
328
|
+
declare const MenuSearchTokenInput: ({ getIsItemVisible, getTokenProps, onChange, inputProps: { value: inputPropsValue, ...inputProps }, value, ...tokenInputProps }: TypeMenuSearchTokenInputProps) => react_jsx_runtime.JSX.Element;
|
|
329
|
+
|
|
330
|
+
type TypeInvalidMenuProps = "initialSelectedItem" | "defaultSelectedItem" | "selectedItem";
|
|
250
331
|
interface TypeActionMenuBaseProps extends TypeMenuRootOwnProps, Omit<TypeDownshiftSelectProps, TypeInvalidMenuProps> {
|
|
251
332
|
}
|
|
252
|
-
type TypeActionMenuProps = TypeActionMenuBaseProps & TypeChildrenOrItems
|
|
333
|
+
type TypeActionMenuProps<I extends TypeMenuItemProps = TypeMenuItemProps> = TypeActionMenuBaseProps & TypeChildrenOrItems<I>;
|
|
253
334
|
|
|
254
335
|
/**
|
|
255
336
|
* @link https://seeds.sproutsocial.com/components/action-menu/
|
|
@@ -260,11 +341,11 @@ type TypeActionMenuProps = TypeActionMenuBaseProps & TypeChildrenOrItems;
|
|
|
260
341
|
* @see {@link https://github.com/sproutsocial/seeds/tree/dev/seeds-react/seeds-react-menu/src/SingleSelectMenu | SingleSelectMenu}
|
|
261
342
|
* @see {@link https://github.com/sproutsocial/seeds/tree/dev/seeds-react/seeds-react-menu/src/MultiSelectMenu | MultiSelectMenu}
|
|
262
343
|
*/
|
|
263
|
-
declare const ActionMenu: ({ children: childrenProp,
|
|
344
|
+
declare const ActionMenu: <I extends TypeMenuItemProps = TypeMenuItemProps>({ children: childrenProp, menuItems, MenuItemComponent, stateReducer: externalStateReducer, ...useSelectProps }: TypeActionMenuProps<I>) => react_jsx_runtime.JSX.Element;
|
|
264
345
|
|
|
265
|
-
interface TypeSingleSelectMenuBaseProps extends TypeMenuRootOwnProps,
|
|
346
|
+
interface TypeSingleSelectMenuBaseProps extends TypeMenuRootOwnProps, TypeDownshiftSelectProps {
|
|
266
347
|
}
|
|
267
|
-
type TypeSingleSelectMenuProps = TypeSingleSelectMenuBaseProps & TypeChildrenOrItems
|
|
348
|
+
type TypeSingleSelectMenuProps<I extends TypeMenuItemProps = TypeMenuItemProps> = TypeSingleSelectMenuBaseProps & TypeChildrenOrItems<I>;
|
|
268
349
|
|
|
269
350
|
/**
|
|
270
351
|
* @link https://seeds.sproutsocial.com/components/singleselect-menu/
|
|
@@ -274,11 +355,11 @@ type TypeSingleSelectMenuProps = TypeSingleSelectMenuBaseProps & TypeChildrenOrI
|
|
|
274
355
|
* **To trigger actions from a menu:**
|
|
275
356
|
* @see {@link https://github.com/sproutsocial/seeds/tree/dev/seeds-react/seeds-react-menu/src/ActionMenu | ActionMenu}
|
|
276
357
|
*/
|
|
277
|
-
declare const SingleSelectMenu: ({ children: childrenProp, stateReducer: externalStateReducer,
|
|
358
|
+
declare const SingleSelectMenu: <I extends TypeMenuItemProps = TypeMenuItemProps>({ children: childrenProp, stateReducer: externalStateReducer, menuItems, MenuItemComponent, ...useSelectProps }: TypeSingleSelectMenuProps<I>) => react_jsx_runtime.JSX.Element;
|
|
278
359
|
|
|
279
|
-
interface TypeMultiSelectMenuBaseProps extends TypeMenuRootOwnProps,
|
|
360
|
+
interface TypeMultiSelectMenuBaseProps extends TypeMenuRootOwnProps, TypeDownshiftSelectProps, TypeDownshiftMultiSelectProps {
|
|
280
361
|
}
|
|
281
|
-
type TypeMultiSelectMenuProps = TypeMultiSelectMenuBaseProps & TypeChildrenOrItems
|
|
362
|
+
type TypeMultiSelectMenuProps<I extends TypeMenuItemProps = TypeMenuItemProps> = TypeMultiSelectMenuBaseProps & TypeChildrenOrItems<I>;
|
|
282
363
|
|
|
283
364
|
/**
|
|
284
365
|
* @link https://seeds.sproutsocial.com/components/multiselect-menu/
|
|
@@ -287,56 +368,131 @@ type TypeMultiSelectMenuProps = TypeMultiSelectMenuBaseProps & TypeChildrenOrIte
|
|
|
287
368
|
*
|
|
288
369
|
* @see {@link https://seeds.sproutsocial.com/components/menu-group/ | MenuGroup}
|
|
289
370
|
*/
|
|
290
|
-
declare const MultiSelectMenu: ({ children: childrenProp,
|
|
371
|
+
declare const MultiSelectMenu: <I extends TypeMenuItemProps = TypeMenuItemProps>({ children: childrenProp, menuItems, MenuItemComponent, onSelectedItemChange: externalOnSelectedItemChange, stateReducer: externalStateReducer, getA11yMultiStatusMessage, onMultiSelectStateChange, multiSelectStateReducer, ...useSelectProps }: TypeMultiSelectMenuProps<I>) => react_jsx_runtime.JSX.Element;
|
|
291
372
|
|
|
292
|
-
|
|
293
|
-
|
|
373
|
+
type TypeSubmenuValidMenuComponentProps<I extends TypeMenuItemProps> = TypeChildrenOrItems<I> & (TypeActionMenuProps<I> | TypeSingleSelectMenuProps<I> | TypeMultiSelectMenuProps<I>);
|
|
374
|
+
interface TypeSubmenuItemProps<I extends TypeMenuItemProps, P extends TypeSubmenuValidMenuComponentProps<I>> extends TypeMenuItemProps {
|
|
375
|
+
isOpen?: boolean;
|
|
376
|
+
onToggleSubmenu?: (isOpen: boolean) => void;
|
|
377
|
+
MenuComponent: React.ComponentType<P>;
|
|
378
|
+
menuProps: Omit<P, "menuToggleElement">;
|
|
294
379
|
}
|
|
295
|
-
|
|
380
|
+
|
|
381
|
+
declare const SubmenuItem: <I extends TypeMenuItemProps, P extends TypeSubmenuValidMenuComponentProps<I>>({ MenuComponent, menuProps: { children: menuChildren, menuItems, MenuItemComponent, popoutProps: { popperProps, ...popoutProps }, onStateChange, ...menuProps }, id, children, ...rest }: TypeSubmenuItemProps<I, P>) => react_jsx_runtime.JSX.Element;
|
|
382
|
+
|
|
383
|
+
type TypeSingleAutocompleteProps<I extends TypeMenuItemProps = TypeMenuItemProps> = TypeMenuRootOwnProps & TypeChildrenOrItems<I> & TypeDownshiftComboboxProps & {
|
|
384
|
+
getIsItemVisible?: TypeGetIsItemVisibleFn;
|
|
385
|
+
};
|
|
386
|
+
type TypeMultiAutocompleteProps<I extends TypeMenuItemProps = TypeMenuItemProps> = TypeSingleAutocompleteProps<I> & TypeDownshiftMultiSelectProps & {
|
|
387
|
+
showSelectedItemsInDropdown?: boolean;
|
|
388
|
+
};
|
|
389
|
+
type TypeAutocompleteProps<I extends TypeMenuItemProps = TypeMenuItemProps> = (TypeSingleAutocompleteProps<I> & {
|
|
390
|
+
multiSelect?: false;
|
|
391
|
+
}) | (TypeMultiAutocompleteProps<I> & {
|
|
392
|
+
multiSelect: true;
|
|
393
|
+
});
|
|
296
394
|
|
|
297
395
|
/**
|
|
298
|
-
* @link https://seeds.sproutsocial.com/components/
|
|
396
|
+
* @link https://seeds.sproutsocial.com/components/autocomplete/
|
|
299
397
|
*
|
|
300
|
-
* @description A Autocomplete allows
|
|
398
|
+
* @description A Autocomplete allows selecting a {@link https://github.com/sproutsocial/seeds/tree/dev/seeds-react/seeds-react-menu/src/MenuItem | MenuItems} to be selected from a list or groups of lists to populate an input.
|
|
301
399
|
*
|
|
302
|
-
* @see {@link https://seeds.sproutsocial.com/components/menu-group/ | MenuGroup}
|
|
303
400
|
*/
|
|
304
|
-
declare const Autocomplete:
|
|
401
|
+
declare const Autocomplete: <I extends TypeMenuItemProps = TypeMenuItemProps>({ multiSelect, ...rest }: TypeAutocompleteProps<I>) => react_jsx_runtime.JSX.Element;
|
|
305
402
|
|
|
306
|
-
|
|
307
|
-
interface TypeAutocompleteInputProps extends Pick<UseComboboxGetInputPropsOptions, TypeInputEventListeners>, Omit<Partial<TypeInputProps>, TypeInputEventListeners> {
|
|
403
|
+
interface TypeAutocompleteInputProps extends TypeDownshiftMergedInputProps<TypeInputProps> {
|
|
308
404
|
}
|
|
309
405
|
declare const AutocompleteInput: ({ onKeyDown, onChange, onInput, onBlur, onClick, inputProps, ...rest }: TypeAutocompleteInputProps) => react_jsx_runtime.JSX.Element;
|
|
310
406
|
|
|
311
|
-
interface
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
407
|
+
interface TypeNestedMenuMapProps<P, I extends TypeMenuItemProps = TypeNestedMenuItemProps> {
|
|
408
|
+
MenuComponent: React.ComponentType<P>;
|
|
409
|
+
menuProps: Omit<P, "menuToggleElement"> & TypeChildrenOrItems<I>;
|
|
410
|
+
/** Defaults to NestedMenuHeader if not provided.
|
|
411
|
+
* This header can be suppressed by passing null.*/
|
|
412
|
+
MenuHeaderComponent?: React.ComponentType<TypeMenuHeaderProps> | null;
|
|
413
|
+
menuHeaderProps?: Partial<TypeMenuHeaderProps>;
|
|
414
|
+
}
|
|
415
|
+
interface TypeNestedMenuHeaderProps extends TypeMenuHeaderProps {
|
|
416
|
+
/** Localized label for the back arrow in this child menu.
|
|
417
|
+
* Overrides the default label passed to NestedMenu. */
|
|
418
|
+
backArrowLabel?: string;
|
|
419
|
+
}
|
|
420
|
+
interface TypeNestedMenuItemProps extends TypeMenuItemProps {
|
|
421
|
+
childMenuId?: string;
|
|
422
|
+
}
|
|
423
|
+
interface TypeNestedMenuProps<I extends TypeMenuItemProps = TypeNestedMenuItemProps> {
|
|
424
|
+
initialMenuId: string;
|
|
425
|
+
menuToggleElement: TypeMenuRootProps["menuToggleElement"];
|
|
426
|
+
onBackButtonClick?: (menuId: string) => void;
|
|
427
|
+
/** Sets the default localized label for the back arrow in all child menus.
|
|
428
|
+
* This label can be overridden by including backArrowLabel in a menu's menuHeaderProps. */
|
|
429
|
+
backArrowLabel?: string;
|
|
430
|
+
/** An object of the menus and child menus to be displayed, keyed by id.*/
|
|
431
|
+
menus: {
|
|
432
|
+
[id: string]: TypeNestedMenuMapProps<TypeActionMenuProps<I>, I> | TypeNestedMenuMapProps<TypeSingleSelectMenuProps<I>, I> | TypeNestedMenuMapProps<TypeMultiSelectMenuProps<I>, I>;
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
declare const NestedMenu: <I extends TypeMenuItemProps = TypeNestedMenuItemProps>({ initialMenuId, menus, onBackButtonClick, backArrowLabel, menuToggleElement, }: TypeNestedMenuProps<I>) => react_jsx_runtime.JSX.Element;
|
|
437
|
+
|
|
438
|
+
declare const NestedMenuItem: ({ children, childMenuId, onClick: onClickProp, ...rest }: TypeNestedMenuItemProps) => react_jsx_runtime.JSX.Element;
|
|
439
|
+
|
|
440
|
+
declare const NestedMenuHeader: ({ backArrowLabel, ...props }: TypeNestedMenuHeaderProps) => react_jsx_runtime.JSX.Element;
|
|
441
|
+
|
|
442
|
+
declare const NestedMenuContent: <I extends TypeMenuItemProps = TypeNestedMenuItemProps>({ innerRef: innerRefProp, onKeyDown: onKeyDownProp, children, menuItems, MenuItemComponent, ...props }: TypeMenuContentProps<I>) => react_jsx_runtime.JSX.Element;
|
|
443
|
+
|
|
444
|
+
interface TypeNestedMenuContext {
|
|
445
|
+
selectedMenuPath: string[];
|
|
446
|
+
setSelectedMenuId?: (id: string) => void;
|
|
447
|
+
setSelectedMenuPath?: (path: string[]) => void;
|
|
448
|
+
goBack?: () => void;
|
|
315
449
|
}
|
|
316
|
-
interface
|
|
317
|
-
|
|
318
|
-
MenuItemComponent: React__default.ComponentType<TypeMenuItemProps>;
|
|
450
|
+
interface TypeNestedMenuProviderProps extends TypeNestedMenuContext {
|
|
451
|
+
children: TypeNotEmptyChildren;
|
|
319
452
|
}
|
|
320
|
-
|
|
321
|
-
type
|
|
322
|
-
|
|
453
|
+
/**
|
|
454
|
+
* NestedMenuContext factory, sets the type and the initial object
|
|
455
|
+
*/
|
|
456
|
+
declare const NestedMenuContext: React__default.Context<TypeNestedMenuContext>;
|
|
457
|
+
/**
|
|
458
|
+
* Provider Component sets the context values in the provider
|
|
459
|
+
*/
|
|
460
|
+
declare const NestedMenuProvider: ({ children, ...nestedMenuProps }: TypeNestedMenuProviderProps) => react_jsx_runtime.JSX.Element;
|
|
461
|
+
/**
|
|
462
|
+
* Utility hook for consuming NestedMenuContext
|
|
463
|
+
*/
|
|
464
|
+
declare const useNestedMenuContext: () => TypeNestedMenuContext;
|
|
465
|
+
|
|
466
|
+
interface TypeMapMenuItemsProps<I extends TypeMenuItemProps = TypeMenuItemProps> {
|
|
467
|
+
menuItems: I[];
|
|
468
|
+
MenuItemComponent?: React__default.ComponentType<I>;
|
|
469
|
+
}
|
|
470
|
+
type TypeItemElement<I extends TypeMenuItemProps = TypeMenuItemProps> = React__default.ReactElement<TypeMenuItemProps | TypeSubmenuItemProps<I, TypeSubmenuValidMenuComponentProps<I>>>;
|
|
471
|
+
type TypeMenuGroupElement<I extends TypeMenuItemProps = TypeMenuItemProps> = React__default.ReactElement<TypeMenuGroupProps<I>>;
|
|
472
|
+
type TypeMenuContentElement<I extends TypeMenuItemProps = TypeMenuItemProps> = React__default.ReactElement<TypeMenuContentProps<I>>;
|
|
323
473
|
interface TypeMenuChildren {
|
|
324
474
|
type: "item" | "group" | "content";
|
|
325
|
-
element:
|
|
475
|
+
element: TypeItemElement | TypeMenuGroupElement | TypeMenuContentElement;
|
|
326
476
|
}
|
|
327
|
-
declare const mapMenuItems: ({
|
|
328
|
-
|
|
329
|
-
|
|
477
|
+
declare const mapMenuItems: <I extends TypeMenuItemProps = TypeMenuItemProps>({ menuItems, MenuItemComponent, }: TypeMapMenuItemsProps<I>) => react_jsx_runtime.JSX.Element;
|
|
478
|
+
type TypeUseMenuChildrenProps<I extends TypeMenuItemProps = TypeMenuItemProps> = {
|
|
479
|
+
children?: TypeMenuRootProps["children"];
|
|
480
|
+
menuItems?: I[];
|
|
481
|
+
MenuItemComponent?: React__default.ComponentType<I>;
|
|
482
|
+
};
|
|
483
|
+
declare const getChildrenFromMenuItems: <I extends TypeMenuItemProps = TypeMenuItemProps>({ menuItems, MenuItemComponent, }: {
|
|
484
|
+
menuItems: I[];
|
|
485
|
+
MenuItemComponent?: React__default.ComponentType<I>;
|
|
486
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
487
|
+
declare const useMenuChildren: <I extends TypeMenuItemProps = TypeMenuItemProps>({ children: childrenProp, menuItems, MenuItemComponent, }: TypeUseMenuChildrenProps<I>) => {
|
|
488
|
+
allMenuItems: TypeInternalItemProps<TypeMenuItemProps>[];
|
|
330
489
|
menuItemsMap: {
|
|
331
|
-
[key: string]:
|
|
490
|
+
[key: string]: TypeInternalItemProps<TypeMenuItemProps>;
|
|
332
491
|
};
|
|
333
492
|
children: TypeNotEmptyChildren;
|
|
334
493
|
};
|
|
335
494
|
|
|
336
|
-
declare const useSelectStateReducer: Required<UseSelectProps<
|
|
337
|
-
declare const
|
|
338
|
-
stateReducer: (state: downshift.UseSelectState<TypeDefaultItemProps>, actionAndChanges: downshift.UseSelectStateChangeOptions<TypeDefaultItemProps>) => Partial<downshift.UseSelectState<TypeDefaultItemProps>>;
|
|
339
|
-
isItemDisabled: (item: any) => boolean;
|
|
340
|
-
};
|
|
495
|
+
declare const useSelectStateReducer: Required<UseSelectProps<TypeInternalItemProps>>["stateReducer"];
|
|
496
|
+
declare const useSelectStateReducerForMulti: Required<UseSelectProps<TypeInternalItemProps>>["stateReducer"];
|
|
341
497
|
|
|
342
|
-
export { ActionMenu, Autocomplete, AutocompleteInput, INPUT_TYPES, type InputType, MenuContent,
|
|
498
|
+
export { ActionMenu, Autocomplete, AutocompleteInput, INPUT_TYPES, type InputType, MenuContent, MenuContentContext, MenuContentProvider, MenuFooter, MenuGroup, MenuHeader, MenuItem, MenuItemAction, MenuItemActionLeft, MenuItemActionRight, MenuItemContainer, MenuItemRow, MenuItemText, MenuLabel, MenuRoot, MenuSearchInput, MenuSearchTokenInput, MenuToggleButton, MenuToggleContext, MenuToggleProvider, MenuTokenInput, MultiSelectMenu, NestedMenu, NestedMenuContent, NestedMenuContext, NestedMenuHeader, NestedMenuItem, NestedMenuProvider, SingleSelectMenu, StyledMenuGroup, StyledMenuGroupUl, StyledMenuItem, StyledTitle, SubmenuItem, type TypeActionMenuBaseProps, type TypeActionMenuProps, type TypeAutocompleteInputProps, type TypeAutocompleteProps, type TypeChildrenOrItems, type TypeDownshiftComboboxProps, type TypeDownshiftComboboxReturnValue, type TypeDownshiftMergedInputProps, type TypeDownshiftMultiSelectProps, type TypeDownshiftMultiSelectReturnValue, type TypeDownshiftSelectProps, type TypeDownshiftSelectReturnValue, type TypeInternalItemProps, type TypeItemElement, type TypeMapMenuItemsProps, type TypeMenuChildren, type TypeMenuContentElement, type TypeMenuContentProps, type TypeMenuContext, type TypeMenuContextBaseProps, type TypeMenuContextProps, type TypeMenuGroupBaseProps, type TypeMenuGroupElement, type TypeMenuGroupProps, type TypeMenuGroupStyledProps, type TypeMenuHeaderProps, type TypeMenuItemProps, type TypeMenuItemStyledProps, type TypeMenuProviderProps, type TypeMenuRootOwnProps, type TypeMenuRootProps, type TypeMenuSearchInputProps, type TypeMenuSearchTokenInputProps, type TypeMenuToggleButtonProps, type TypeMenuToggleContext, type TypeMenuToggleProviderProps, type TypeMenuTokenInputProps, type TypeMultiAutocompleteProps, type TypeMultiSelectMenuBaseProps, type TypeMultiSelectMenuProps, type TypeNestedMenuContext, type TypeNestedMenuHeaderProps, type TypeNestedMenuItemProps, type TypeNestedMenuMapProps, type TypeNestedMenuProps, type TypeNestedMenuProviderProps, type TypeNotEmptyChildren, type TypeSingleAutocompleteProps, type TypeSingleSelectMenuBaseProps, type TypeSingleSelectMenuProps, type TypeSubmenuItemProps, type TypeSubmenuValidMenuComponentProps, checkIfItemSelected, defaultMenuContext, getChildrenFromMenuItems, getSelectedItemIds, mapMenuItems, useMenu, useMenuChildren, useMenuContentContext, useMenuToggleContext, useNestedMenuContext, useSelectStateReducer, useSelectStateReducerForMulti };
|