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