@sproutsocial/seeds-react-menu 0.4.1 → 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 +32 -0
- package/dist/esm/index.js +1553 -423
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +303 -122
- package/dist/index.d.ts +303 -122
- package/dist/index.js +1561 -405
- 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 +30 -26
- package/src/ActionMenu/ActionMenuTypes.ts +13 -8
- package/src/ActionMenu/__tests__/ActionMenu.test.tsx +17 -30
- package/src/ActionMenu/__tests__/ActionMenu.typetest.tsx +32 -3
- package/src/Autocomplete/Autocomplete.stories.tsx +61 -2
- package/src/Autocomplete/Autocomplete.tsx +15 -74
- package/src/Autocomplete/AutocompleteInput.tsx +18 -27
- package/src/Autocomplete/AutocompleteTokenInput.tsx +50 -0
- package/src/Autocomplete/AutocompleteTypes.ts +27 -11
- 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 +116 -3
- package/src/MenuContent/MenuContent.stories.tsx +164 -0
- package/src/MenuContent/MenuContent.tsx +35 -8
- package/src/MenuContent/MenuContentTypes.ts +7 -5
- package/src/MenuContent/__tests__/MenuContent.typetest.tsx +18 -2
- 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 +21 -21
- package/src/MenuGroup/MenuGroup.stories.tsx +248 -0
- package/src/MenuGroup/MenuGroup.tsx +9 -7
- package/src/MenuGroup/MenuGroupTypes.ts +8 -6
- package/src/MenuGroup/__tests__/MenuGroup.test.tsx +6 -6
- package/src/MenuGroup/__tests__/MenuGroup.typetest.tsx +23 -4
- 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 -9
- 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 +44 -67
- package/src/MultiSelectMenu/MultiSelectMenuTypes.ts +9 -5
- package/src/MultiSelectMenu/__tests__/MultiSelectMenu.test.tsx +46 -60
- package/src/MultiSelectMenu/__tests__/MultiSelectMenu.typetest.tsx +29 -2
- 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 +29 -25
- package/src/SingleSelectMenu/SingleSelectMenuTypes.ts +9 -5
- package/src/SingleSelectMenu/__tests__/SingleSelectMenu.typetest.tsx +32 -2
- 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/__tests__/Menu.test.tsx +38 -0
- package/src/hooks/useDownshiftDefaults.tsx +107 -0
- package/src/hooks/useItemFiltering.tsx +66 -0
- package/src/hooks/useMenuChildren.tsx +279 -0
- package/src/index.ts +7 -1
- 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 -5
- package/src/utils/downshiftDefaults.ts +9 -0
- package/src/utils/getMultiSelectOverrides.ts +21 -0
- package/src/utils/reduceReducers.ts +19 -0
- package/src/hooks/useItemsFromChildren.tsx +0 -131
- package/src/utils/itemToString.ts +0 -5
package/dist/index.d.mts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import { UseComboboxProps, UseSelectProps, UseMultipleSelectionProps, UseComboboxReturnValue, UseSelectReturnValue, UseMultipleSelectionReturnValue, UseComboboxGetInputPropsOptions, GetItemPropsOptions } from 'downshift';
|
|
3
|
+
import { TypeBorderSystemProps, TypeColorSystemProps, TypeFlexboxSystemProps, TypeGridSystemProps, TypeLayoutSystemProps, TypePositionSystemProps, TypeSpaceSystemProps, TypeTypographySystemProps, TypeStyledComponentsCommonProps } from '@sproutsocial/seeds-react-system-props';
|
|
4
4
|
import * as React$1 from 'react';
|
|
5
5
|
import React__default, { ReactNode } from 'react';
|
|
6
|
-
import {
|
|
6
|
+
import { TypePopoutProps } from '@sproutsocial/seeds-react-popout';
|
|
7
|
+
import { TypeTokenInputProps, TypeTokenSpec } from '@sproutsocial/seeds-react-token-input';
|
|
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 TypeMenuGroupBaseProps 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<I extends TypeMenuItemProps = TypeMenuItemProps> = TypeMenuGroupBaseProps & TypeChildrenOrItems<I>;
|
|
37
35
|
|
|
38
36
|
/**
|
|
39
37
|
* @link https://seeds.sproutsocial.com/components/menu-group/
|
|
@@ -54,21 +52,160 @@ interface TypeMenuGroupProps extends TypeMenuGroupStyledProps, Omit<React.Compon
|
|
|
54
52
|
*
|
|
55
53
|
* @see {@link https://seeds.sproutsocial.com/components/menu-item/ | MenuItem}
|
|
56
54
|
*/
|
|
57
|
-
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;
|
|
58
56
|
|
|
59
|
-
declare const StyledMenuGroup: styled_components.StyledComponent<"li", styled_components.DefaultTheme,
|
|
57
|
+
declare const StyledMenuGroup: styled_components.StyledComponent<"li", styled_components.DefaultTheme, TypeMenuGroupBaseProps, never>;
|
|
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
|
|
|
63
|
-
interface
|
|
61
|
+
interface TypeDownshiftComboboxProps extends Partial<UseComboboxProps<TypeInternalItemProps>> {
|
|
62
|
+
}
|
|
63
|
+
interface TypeDownshiftSelectProps extends Partial<UseSelectProps<TypeInternalItemProps>> {
|
|
64
|
+
}
|
|
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
|
+
}
|
|
70
|
+
interface TypeDownshiftComboboxReturnValue extends Partial<UseComboboxReturnValue<TypeInternalItemProps>> {
|
|
71
|
+
}
|
|
72
|
+
interface TypeDownshiftSelectReturnValue extends Partial<UseSelectReturnValue<TypeInternalItemProps>> {
|
|
73
|
+
}
|
|
74
|
+
interface TypeDownshiftMultiSelectReturnValue extends Partial<UseMultipleSelectionReturnValue<TypeInternalItemProps>> {
|
|
75
|
+
}
|
|
76
|
+
type TypeDonwshiftSharedReturnValue = "getLabelProps" | "getToggleButtonProps" | "getMenuProps";
|
|
77
|
+
type TypeDonwshiftSharedProps = "onHighlightedIndexChange" | "onIsOpenChange" | "onSelectedItemChange" | "onStateChange" | "stateReducer";
|
|
78
|
+
interface TypeMenuContextBaseProps {
|
|
79
|
+
itemsMap?: {
|
|
80
|
+
[key: string]: TypeInternalItemProps;
|
|
81
|
+
};
|
|
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 {
|
|
90
|
+
onHighlightedIndexChange?: TypeDownshiftComboboxProps["onHighlightedIndexChange"] | TypeDownshiftSelectProps["onHighlightedIndexChange"];
|
|
91
|
+
onIsOpenChange?: TypeDownshiftComboboxProps["onIsOpenChange"] | TypeDownshiftSelectProps["onIsOpenChange"];
|
|
92
|
+
onSelectedItemChange?: TypeDownshiftComboboxProps["onSelectedItemChange"] | TypeDownshiftSelectProps["onSelectedItemChange"];
|
|
93
|
+
onStateChange?: TypeDownshiftComboboxProps["onStateChange"] | TypeDownshiftSelectProps["onStateChange"];
|
|
94
|
+
stateReducer?: TypeDownshiftComboboxProps["stateReducer"] | TypeDownshiftSelectProps["stateReducer"];
|
|
95
|
+
getLabelProps?: TypeDownshiftComboboxReturnValue["getLabelProps"] | TypeDownshiftSelectReturnValue["getLabelProps"];
|
|
96
|
+
getToggleButtonProps?: TypeDownshiftComboboxReturnValue["getToggleButtonProps"] | TypeDownshiftSelectReturnValue["getToggleButtonProps"];
|
|
97
|
+
getMenuProps?: TypeDownshiftComboboxReturnValue["getMenuProps"] | TypeDownshiftSelectReturnValue["getMenuProps"];
|
|
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
|
+
}
|
|
109
|
+
interface TypeMenuContext extends TypeMenuContextProps {
|
|
110
|
+
itemsMap: {
|
|
111
|
+
[key: string]: TypeInternalItemProps;
|
|
112
|
+
};
|
|
113
|
+
isItemSelected: (id: string) => boolean;
|
|
114
|
+
getInputComponentProps: (props: Pick<TypeTokenInputProps, "inputProps"> & Parameters<Required<TypeMenuContextProps>["getInputProps"]>[0]) => Omit<TypeDownshiftMergedInputProps<TypeTokenInputProps>, "onClick">;
|
|
115
|
+
}
|
|
116
|
+
interface TypeMenuProviderProps {
|
|
117
|
+
children: TypeNotEmptyChildren;
|
|
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>;
|
|
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;
|
|
140
|
+
/**
|
|
141
|
+
* Hook for initializing Menu context
|
|
142
|
+
*/
|
|
143
|
+
declare const useMenu: ({ items, isListbox, isOpen, itemsMap: itemsMapFromProps, selectedItemIds: selectedItemIdsFromProps, selectedItem, selectedItems, getInputProps, contentRef: contentRefFromProps, ...rest }?: Partial<TypeMenuContextProps>) => TypeMenuContext;
|
|
144
|
+
/**
|
|
145
|
+
* MenuToggleContext factory, sets the type and the initial object
|
|
146
|
+
* @description Context for the Menu Toggle
|
|
147
|
+
*/
|
|
148
|
+
declare const MenuToggleContext: React__default.Context<TypeMenuToggleContext>;
|
|
149
|
+
/**
|
|
150
|
+
* MenuToggleProvider Component sets the context values into the provider
|
|
151
|
+
* @description Context Provider for the Menu Toggle
|
|
152
|
+
*/
|
|
153
|
+
declare const MenuToggleProvider: ({ children, menuContext, }: TypeMenuToggleProviderProps) => react_jsx_runtime.JSX.Element;
|
|
154
|
+
/**
|
|
155
|
+
* Utility hook for consuming MenuToggleContext
|
|
156
|
+
*/
|
|
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;
|
|
172
|
+
|
|
173
|
+
interface TypeMenuRootOwnProps {
|
|
174
|
+
menuToggleElement: React__default.ReactElement<any>;
|
|
175
|
+
popoutProps?: Partial<Omit<TypePopoutProps, "isOpen" | "setIsOpen" | "content" | "children">>;
|
|
176
|
+
width?: TypePopoutProps["width"];
|
|
177
|
+
}
|
|
178
|
+
interface TypeMenuRootProps extends Partial<TypeMenuContextProps>, Pick<TypeMenuProviderProps, "children">, TypeMenuRootOwnProps {
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* @link https://seeds.sproutsocial.com/components/menu-root/
|
|
182
|
+
*
|
|
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.
|
|
184
|
+
*/
|
|
185
|
+
declare const MenuRoot: ({ children, menuToggleElement, popoutProps: { placement, focusLockProps, ...popoutProps }, width, ...contextProps }: TypeMenuRootProps) => react_jsx_runtime.JSX.Element;
|
|
186
|
+
|
|
187
|
+
interface TypeInternalItemProps<Item = TypeMenuItemProps> {
|
|
64
188
|
id: string;
|
|
65
189
|
index: number;
|
|
66
190
|
disabled?: boolean;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
menuGroupProps?: TypeMenuGroupProps;
|
|
191
|
+
menuItemProps?: Item;
|
|
192
|
+
menuGroupProps?: TypeMenuGroupBaseProps;
|
|
70
193
|
}
|
|
194
|
+
type TypeChildrenOrItems<I extends TypeMenuItemProps = TypeMenuItemProps> = {
|
|
195
|
+
/** Allows menu items to be passed in as children. Cannot be used with the items prop.*/
|
|
196
|
+
children: TypeMenuRootProps["children"];
|
|
197
|
+
menuItems?: never;
|
|
198
|
+
MenuItemComponent?: never;
|
|
199
|
+
} | {
|
|
200
|
+
children?: never;
|
|
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>;
|
|
205
|
+
};
|
|
71
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>;
|
|
72
209
|
|
|
73
210
|
interface TypeMenuItemStyledProps extends TypeBorderSystemProps, TypeColorSystemProps, TypeFlexboxSystemProps, TypeGridSystemProps, TypeLayoutSystemProps, TypePositionSystemProps, TypeSpaceSystemProps, TypeTypographySystemProps {
|
|
74
211
|
}
|
|
@@ -79,24 +216,28 @@ declare const INPUT_TYPES: {
|
|
|
79
216
|
readonly ICON: "icon";
|
|
80
217
|
};
|
|
81
218
|
type InputType = (typeof INPUT_TYPES)[keyof typeof INPUT_TYPES];
|
|
82
|
-
interface TypeMenuItemProps extends TypeMenuItemStyledProps, Omit<GetItemPropsOptions<
|
|
219
|
+
interface TypeMenuItemProps extends TypeMenuItemStyledProps, Omit<GetItemPropsOptions<TypeInternalItemProps>, "as" | "item" | "ref" | keyof TypeMenuItemStyledProps | keyof TypeInternalItemProps>, Omit<TypeInternalItemProps, "index"> {
|
|
83
220
|
children: React.ReactNode;
|
|
84
221
|
disabled?: boolean;
|
|
85
222
|
role?: TypeMenuItemRoles;
|
|
223
|
+
innerRef?: React.Ref<any>;
|
|
86
224
|
$highlighted?: boolean;
|
|
87
225
|
active?: boolean;
|
|
88
226
|
inputType?: InputType;
|
|
89
227
|
inputLabelId?: string;
|
|
90
228
|
}
|
|
91
229
|
|
|
92
|
-
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;
|
|
93
231
|
|
|
94
232
|
declare const MenuItemContainer: styled_components.StyledComponent<"li", styled_components.DefaultTheme, {}, never>;
|
|
95
|
-
declare const StyledMenuItem: styled_components.StyledComponent<"
|
|
233
|
+
declare const StyledMenuItem: styled_components.StyledComponent<"button", styled_components.DefaultTheme, {
|
|
96
234
|
$highlighted: boolean;
|
|
235
|
+
$active?: boolean;
|
|
97
236
|
}, never>;
|
|
98
237
|
declare const MenuItemRow: styled_components.StyledComponent<"div", styled_components.DefaultTheme, {}, never>;
|
|
99
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>;
|
|
100
241
|
declare const MenuItemText: styled_components.StyledComponent<"div", styled_components.DefaultTheme, {}, never>;
|
|
101
242
|
|
|
102
243
|
interface TypeMenuHeaderProps extends Omit<React$1.ComponentPropsWithoutRef<"div">, "color">, TypeStyledComponentsCommonProps, TypeBorderSystemProps, TypeColorSystemProps, TypeFlexboxSystemProps, TypeGridSystemProps, TypeLayoutSystemProps, TypeSpaceSystemProps, TypePositionSystemProps {
|
|
@@ -114,9 +255,9 @@ interface TypeMenuHeaderProps extends Omit<React$1.ComponentPropsWithoutRef<"div
|
|
|
114
255
|
*/
|
|
115
256
|
declare const MenuHeader: ({ children, title, leftAction, rightAction, ...rest }: TypeMenuHeaderProps) => react_jsx_runtime.JSX.Element;
|
|
116
257
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
258
|
+
type TypeMenuContentProps<I extends TypeMenuItemProps = TypeMenuItemProps> = Omit<HTMLMotionProps<"ul">, "children"> & {
|
|
259
|
+
innerRef?: React.Ref<HTMLUListElement>;
|
|
260
|
+
} & TypeChildrenOrItems<I>;
|
|
120
261
|
|
|
121
262
|
/**
|
|
122
263
|
* @link https://seeds.sproutsocial.com/components/menu-content/
|
|
@@ -140,7 +281,7 @@ interface TypeMenuContentProps extends HTMLMotionProps<"ul"> {
|
|
|
140
281
|
* @see {@link https://seeds.sproutsocial.com/components/menu-item/ | MenuItem}
|
|
141
282
|
* @see {@link https://seeds.sproutsocial.com/components/menu-group/ | MenuGroup}
|
|
142
283
|
*/
|
|
143
|
-
declare const MenuContent: ({ id, children, ...rest }: TypeMenuContentProps) => react_jsx_runtime.JSX.Element;
|
|
284
|
+
declare const MenuContent: <I extends TypeMenuItemProps = TypeMenuItemProps>({ id, children: childrenProp, menuItems, MenuItemComponent, onKeyDown, innerRef, ...rest }: TypeMenuContentProps<I>) => react_jsx_runtime.JSX.Element | null;
|
|
144
285
|
|
|
145
286
|
/**
|
|
146
287
|
* @link https://seeds.sproutsocial.com/components/menu-footer/
|
|
@@ -151,89 +292,45 @@ declare const MenuContent: ({ id, children, ...rest }: TypeMenuContentProps) =>
|
|
|
151
292
|
*/
|
|
152
293
|
declare const MenuFooter: ({ children, ...rest }: TypeBoxProps) => react_jsx_runtime.JSX.Element;
|
|
153
294
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
interface
|
|
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
|
-
};
|
|
295
|
+
declare const MenuLabel: ({ children, ...rest }: Partial<TypeLabelProps>) => react_jsx_runtime.JSX.Element;
|
|
296
|
+
|
|
297
|
+
interface TypeMenuToggleButtonProps extends Partial<TypeButtonProps> {
|
|
298
|
+
children: ReactNode;
|
|
190
299
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
300
|
+
declare const MenuToggleButton: ({ children, ...rest }: TypeMenuToggleButtonProps) => react_jsx_runtime.JSX.Element;
|
|
301
|
+
|
|
302
|
+
type TypeGetIsItemVisibleFn = (item: TypeMenuContext["items"][number], inputValue: string) => boolean;
|
|
303
|
+
|
|
304
|
+
interface TypeMenuSearchInputProps extends TypeInputProps {
|
|
305
|
+
getIsItemVisible?: TypeGetIsItemVisibleFn;
|
|
194
306
|
}
|
|
195
307
|
/**
|
|
196
|
-
*
|
|
197
|
-
|
|
198
|
-
|
|
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
|
|
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.
|
|
209
311
|
*/
|
|
210
|
-
declare const
|
|
312
|
+
declare const MenuSearchInput: ({ getIsItemVisible, ...inputProps }: TypeMenuSearchInputProps) => react_jsx_runtime.JSX.Element;
|
|
211
313
|
|
|
212
|
-
interface
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
width?: TypePopoutProps["width"];
|
|
314
|
+
interface TypeMenuTokenInputProps extends TypeTokenInputProps {
|
|
315
|
+
getTokenProps?: (itemId: TypeInternalItemProps["id"]) => Partial<TypeTokenSpec>;
|
|
316
|
+
MenuContext?: typeof MenuToggleContext | typeof MenuContentContext;
|
|
216
317
|
}
|
|
217
|
-
|
|
318
|
+
declare const MenuTokenInput: ({ inputProps, getTokenProps, onKeyDown, MenuContext, ...tokenInputProps }: TypeMenuTokenInputProps) => react_jsx_runtime.JSX.Element;
|
|
319
|
+
|
|
320
|
+
interface TypeMenuSearchTokenInputProps extends TypeMenuTokenInputProps {
|
|
321
|
+
getIsItemVisible?: TypeGetIsItemVisibleFn;
|
|
218
322
|
}
|
|
219
323
|
/**
|
|
220
|
-
* @link https://seeds.sproutsocial.com/components/menu-
|
|
324
|
+
* @link https://seeds.sproutsocial.com/components/menu-search-token-input/
|
|
221
325
|
*
|
|
222
|
-
* @description
|
|
326
|
+
* @description MenuSearchTokenInput is search token input that can be added to the MenuHeader to filter the items.
|
|
223
327
|
*/
|
|
224
|
-
declare const
|
|
225
|
-
|
|
226
|
-
declare const MenuLabel: ({ children, ...rest }: Partial<TypeLabelProps>) => react_jsx_runtime.JSX.Element;
|
|
227
|
-
|
|
228
|
-
interface TypeMenuToggleButtonProps extends Partial<TypeButtonProps> {
|
|
229
|
-
children: ReactNode;
|
|
230
|
-
}
|
|
231
|
-
declare const MenuToggleButton: ({ children, ...rest }: TypeMenuToggleButtonProps) => react_jsx_runtime.JSX.Element;
|
|
328
|
+
declare const MenuSearchTokenInput: ({ getIsItemVisible, getTokenProps, onChange, inputProps: { value: inputPropsValue, ...inputProps }, value, ...tokenInputProps }: TypeMenuSearchTokenInputProps) => react_jsx_runtime.JSX.Element;
|
|
232
329
|
|
|
233
330
|
type TypeInvalidMenuProps = "initialSelectedItem" | "defaultSelectedItem" | "selectedItem";
|
|
234
|
-
interface
|
|
235
|
-
children: TypeMenuRootProps["children"];
|
|
331
|
+
interface TypeActionMenuBaseProps extends TypeMenuRootOwnProps, Omit<TypeDownshiftSelectProps, TypeInvalidMenuProps> {
|
|
236
332
|
}
|
|
333
|
+
type TypeActionMenuProps<I extends TypeMenuItemProps = TypeMenuItemProps> = TypeActionMenuBaseProps & TypeChildrenOrItems<I>;
|
|
237
334
|
|
|
238
335
|
/**
|
|
239
336
|
* @link https://seeds.sproutsocial.com/components/action-menu/
|
|
@@ -244,11 +341,11 @@ interface TypeActionMenuProps extends TypeMenuRootOwnProps, Omit<TypeDownshiftSe
|
|
|
244
341
|
* @see {@link https://github.com/sproutsocial/seeds/tree/dev/seeds-react/seeds-react-menu/src/SingleSelectMenu | SingleSelectMenu}
|
|
245
342
|
* @see {@link https://github.com/sproutsocial/seeds/tree/dev/seeds-react/seeds-react-menu/src/MultiSelectMenu | MultiSelectMenu}
|
|
246
343
|
*/
|
|
247
|
-
declare const ActionMenu: ({ children, stateReducer: externalStateReducer, ...useSelectProps }: TypeActionMenuProps) => react_jsx_runtime.JSX.Element;
|
|
344
|
+
declare const ActionMenu: <I extends TypeMenuItemProps = TypeMenuItemProps>({ children: childrenProp, menuItems, MenuItemComponent, stateReducer: externalStateReducer, ...useSelectProps }: TypeActionMenuProps<I>) => react_jsx_runtime.JSX.Element;
|
|
248
345
|
|
|
249
|
-
interface
|
|
250
|
-
children: TypeMenuRootProps["children"];
|
|
346
|
+
interface TypeSingleSelectMenuBaseProps extends TypeMenuRootOwnProps, TypeDownshiftSelectProps {
|
|
251
347
|
}
|
|
348
|
+
type TypeSingleSelectMenuProps<I extends TypeMenuItemProps = TypeMenuItemProps> = TypeSingleSelectMenuBaseProps & TypeChildrenOrItems<I>;
|
|
252
349
|
|
|
253
350
|
/**
|
|
254
351
|
* @link https://seeds.sproutsocial.com/components/singleselect-menu/
|
|
@@ -258,11 +355,11 @@ interface TypeSingleSelectMenuProps extends TypeMenuRootOwnProps, TypeDownshiftS
|
|
|
258
355
|
* **To trigger actions from a menu:**
|
|
259
356
|
* @see {@link https://github.com/sproutsocial/seeds/tree/dev/seeds-react/seeds-react-menu/src/ActionMenu | ActionMenu}
|
|
260
357
|
*/
|
|
261
|
-
declare const SingleSelectMenu: ({ children, stateReducer: externalStateReducer, ...useSelectProps }: TypeSingleSelectMenuProps) => react_jsx_runtime.JSX.Element;
|
|
358
|
+
declare const SingleSelectMenu: <I extends TypeMenuItemProps = TypeMenuItemProps>({ children: childrenProp, stateReducer: externalStateReducer, menuItems, MenuItemComponent, ...useSelectProps }: TypeSingleSelectMenuProps<I>) => react_jsx_runtime.JSX.Element;
|
|
262
359
|
|
|
263
|
-
interface
|
|
264
|
-
children: TypeMenuRootProps["children"];
|
|
360
|
+
interface TypeMultiSelectMenuBaseProps extends TypeMenuRootOwnProps, TypeDownshiftSelectProps, TypeDownshiftMultiSelectProps {
|
|
265
361
|
}
|
|
362
|
+
type TypeMultiSelectMenuProps<I extends TypeMenuItemProps = TypeMenuItemProps> = TypeMultiSelectMenuBaseProps & TypeChildrenOrItems<I>;
|
|
266
363
|
|
|
267
364
|
/**
|
|
268
365
|
* @link https://seeds.sproutsocial.com/components/multiselect-menu/
|
|
@@ -271,47 +368,131 @@ interface TypeMultiSelectMenuProps extends TypeMenuRootOwnProps, TypeDownshiftSe
|
|
|
271
368
|
*
|
|
272
369
|
* @see {@link https://seeds.sproutsocial.com/components/menu-group/ | MenuGroup}
|
|
273
370
|
*/
|
|
274
|
-
declare const MultiSelectMenu: ({ children, stateReducer: externalStateReducer, getA11yMultiStatusMessage, onMultiSelectStateChange, multiSelectStateReducer, ...useSelectProps }: TypeMultiSelectMenuProps) => react_jsx_runtime.JSX.Element;
|
|
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;
|
|
275
372
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
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">;
|
|
279
379
|
}
|
|
280
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
|
+
});
|
|
394
|
+
|
|
281
395
|
/**
|
|
282
|
-
* @link https://seeds.sproutsocial.com/components/
|
|
396
|
+
* @link https://seeds.sproutsocial.com/components/autocomplete/
|
|
283
397
|
*
|
|
284
|
-
* @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.
|
|
285
399
|
*
|
|
286
|
-
* @see {@link https://seeds.sproutsocial.com/components/menu-group/ | MenuGroup}
|
|
287
400
|
*/
|
|
288
|
-
declare const Autocomplete:
|
|
401
|
+
declare const Autocomplete: <I extends TypeMenuItemProps = TypeMenuItemProps>({ multiSelect, ...rest }: TypeAutocompleteProps<I>) => react_jsx_runtime.JSX.Element;
|
|
289
402
|
|
|
290
|
-
|
|
291
|
-
interface TypeAutocompleteInputProps extends Pick<UseComboboxGetInputPropsOptions, TypeInputEventListeners>, Omit<Partial<TypeInputProps>, TypeInputEventListeners> {
|
|
403
|
+
interface TypeAutocompleteInputProps extends TypeDownshiftMergedInputProps<TypeInputProps> {
|
|
292
404
|
}
|
|
293
405
|
declare const AutocompleteInput: ({ onKeyDown, onChange, onInput, onBlur, onClick, inputProps, ...rest }: TypeAutocompleteInputProps) => react_jsx_runtime.JSX.Element;
|
|
294
406
|
|
|
295
|
-
interface
|
|
296
|
-
|
|
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;
|
|
297
419
|
}
|
|
298
|
-
|
|
299
|
-
|
|
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;
|
|
449
|
+
}
|
|
450
|
+
interface TypeNestedMenuProviderProps extends TypeNestedMenuContext {
|
|
451
|
+
children: TypeNotEmptyChildren;
|
|
452
|
+
}
|
|
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>>;
|
|
300
473
|
interface TypeMenuChildren {
|
|
301
|
-
type: "item" | "group";
|
|
302
|
-
element:
|
|
474
|
+
type: "item" | "group" | "content";
|
|
475
|
+
element: TypeItemElement | TypeMenuGroupElement | TypeMenuContentElement;
|
|
303
476
|
}
|
|
304
|
-
declare const
|
|
305
|
-
|
|
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>[];
|
|
306
489
|
menuItemsMap: {
|
|
307
|
-
[key: string]:
|
|
490
|
+
[key: string]: TypeInternalItemProps<TypeMenuItemProps>;
|
|
308
491
|
};
|
|
492
|
+
children: TypeNotEmptyChildren;
|
|
309
493
|
};
|
|
310
494
|
|
|
311
|
-
declare const useSelectStateReducer: Required<UseSelectProps<
|
|
312
|
-
declare const
|
|
313
|
-
stateReducer: (state: downshift.UseSelectState<TypeDefaultItemProps>, actionAndChanges: downshift.UseSelectStateChangeOptions<TypeDefaultItemProps>) => Partial<downshift.UseSelectState<TypeDefaultItemProps>>;
|
|
314
|
-
isItemDisabled: (item: any) => boolean;
|
|
315
|
-
};
|
|
495
|
+
declare const useSelectStateReducer: Required<UseSelectProps<TypeInternalItemProps>>["stateReducer"];
|
|
496
|
+
declare const useSelectStateReducerForMulti: Required<UseSelectProps<TypeInternalItemProps>>["stateReducer"];
|
|
316
497
|
|
|
317
|
-
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 };
|