@sproutsocial/seeds-react-menu 0.1.0 → 0.2.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 +17 -1
- package/dist/esm/index.js +209 -198
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +103 -37
- package/dist/index.d.ts +103 -37
- package/dist/index.js +239 -229
- package/dist/index.js.map +1 -1
- package/package.json +6 -5
- package/src/ActionMenu/ActionMenu.feature +9 -3
- package/src/ActionMenu/ActionMenu.tsx +75 -42
- package/src/ActionMenu/__tests__/ActionMenu.test.tsx +36 -42
- package/src/ActionMenu/__tests__/ActionMenu.typetest.tsx +13 -13
- package/src/MenuContent/MenuContent.tsx +31 -1
- package/src/MenuContent/MenuContentTypes.ts +2 -2
- package/src/MenuContent/styles.tsx +10 -6
- package/src/MenuFooter/MenuFooter.feature +1 -1
- package/src/MenuFooter/MenuFooter.tsx +8 -0
- package/src/MenuFooter/__tests__/MenuFooter.test.tsx +53 -26
- package/src/MenuFooter/styles.tsx +1 -1
- package/src/MenuGroup/MenuGroup.feature +14 -26
- package/src/MenuGroup/MenuGroup.tsx +21 -1
- package/src/MenuGroup/__tests__/MenuGroup.test.tsx +40 -6
- package/src/MenuGroup/styles.tsx +4 -3
- package/src/MenuHeader/MenuHeader.tsx +16 -5
- package/src/MenuHeader/__tests__/MenuHeader.test.tsx +50 -6
- package/src/MenuHeader/styles.tsx +21 -22
- package/src/MenuItem/MenuItem.feature +66 -26
- package/src/MenuItem/MenuItem.tsx +35 -20
- package/src/MenuItem/MenuItemTypes.ts +13 -1
- package/src/MenuItem/__tests__/MenuItem.test.tsx +431 -154
- package/src/MenuItem/__tests__/MenuItem.typetest.tsx +57 -38
- package/src/MenuItem/styles.tsx +42 -3
- package/src/{MenuItemSelectable/MenuItemSelectable.tsx → MenuItem/useOptionProps.tsx} +31 -54
- package/src/MenuRoot/MenuRoot.tsx +12 -17
- package/src/MenuRoot/__tests__/MenuRoot.test.tsx +3 -3
- package/src/MenuRoot/__tests__/MenuRoot.typetest.tsx +10 -10
- package/src/MultiSelectMenu/MultiSelectMenu.tsx +8 -1
- package/src/MultiSelectMenu/__tests__/MultiSelectMenu.test.tsx +19 -19
- package/src/MultiSelectMenu/__tests__/MultiSelectMenu.typetest.tsx +10 -10
- package/src/SingleSelectMenu/SingleSelectMenu.feature +11 -0
- package/src/SingleSelectMenu/SingleSelectMenu.tsx +9 -0
- package/src/SingleSelectMenu/__tests__/SingleSelectMenu.test.tsx +11 -14
- package/src/SingleSelectMenu/__tests__/SingleSelectMenu.typetest.tsx +14 -14
- package/src/__tests__/Menu.test.tsx +20 -16
- package/src/hooks/useItemsFromChildren.tsx +1 -4
- package/src/index.ts +0 -1
- package/src/menuTestingUtils.tsx +7 -4
- package/src/MenuItemSelectable/MenuItemSelectable.feature +0 -99
- package/src/MenuItemSelectable/MenuItemSelectableTypes.ts +0 -15
- package/src/MenuItemSelectable/__tests__/MenuItemSelectable.test.tsx +0 -303
- package/src/MenuItemSelectable/__tests__/MenuItemSelectable.typetest.tsx +0 -56
- package/src/MenuItemSelectable/index.ts +0 -5
- package/src/MenuItemSelectable/styles.tsx +0 -21
package/dist/index.d.mts
CHANGED
|
@@ -5,6 +5,7 @@ import { TypeBorderSystemProps, TypeColorSystemProps, TypeFlexboxSystemProps, Ty
|
|
|
5
5
|
import * as styled_components from 'styled-components';
|
|
6
6
|
import * as React$1 from 'react';
|
|
7
7
|
import React__default, { ReactNode } from 'react';
|
|
8
|
+
import { HTMLMotionProps } from 'motion/react';
|
|
8
9
|
import { TypeBoxProps } from '@sproutsocial/seeds-react-box';
|
|
9
10
|
export { TypeBoxProps as TypeMenuFooterProps } from '@sproutsocial/seeds-react-box';
|
|
10
11
|
import * as _sproutsocial_seeds_react_text from '@sproutsocial/seeds-react-text';
|
|
@@ -34,20 +35,6 @@ type TypeNotEmptyChildren = React.ReactChild | React.ReactFragment | React.React
|
|
|
34
35
|
|
|
35
36
|
interface TypeMenuItemStyledProps extends TypeBorderSystemProps, TypeColorSystemProps, TypeFlexboxSystemProps, TypeGridSystemProps, TypeLayoutSystemProps, TypePositionSystemProps, TypeSpaceSystemProps, TypeTypographySystemProps {
|
|
36
37
|
}
|
|
37
|
-
interface TypeMenuItemProps extends TypeMenuItemStyledProps, Omit<GetItemPropsOptions<TypeDefaultItemProps>, "as" | "item" | keyof TypeMenuItemStyledProps | keyof TypeDefaultItemProps>, Omit<TypeDefaultItemProps, "index"> {
|
|
38
|
-
label?: string;
|
|
39
|
-
children: React.ReactNode;
|
|
40
|
-
disabled?: boolean;
|
|
41
|
-
role?: TypeMenuItemRoles;
|
|
42
|
-
$highlighted?: boolean;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
declare const MenuItem: ({ id, children, role, label, onClick, onKeyDown, disabled, ref, color, ...props }: TypeMenuItemProps) => react_jsx_runtime.JSX.Element;
|
|
46
|
-
|
|
47
|
-
declare const MenuItemContainer: styled_components.StyledComponent<"li", styled_components.DefaultTheme, {
|
|
48
|
-
$highlighted: boolean;
|
|
49
|
-
}, never>;
|
|
50
|
-
|
|
51
38
|
declare const INPUT_TYPES: {
|
|
52
39
|
readonly CHECKBOX: "checkbox";
|
|
53
40
|
readonly RADIO: "radio";
|
|
@@ -55,30 +42,25 @@ declare const INPUT_TYPES: {
|
|
|
55
42
|
readonly ICON: "icon";
|
|
56
43
|
};
|
|
57
44
|
type InputType = (typeof INPUT_TYPES)[keyof typeof INPUT_TYPES];
|
|
58
|
-
interface
|
|
45
|
+
interface TypeMenuItemProps extends TypeMenuItemStyledProps, Omit<GetItemPropsOptions<TypeDefaultItemProps>, "as" | "item" | keyof TypeMenuItemStyledProps | keyof TypeDefaultItemProps>, Omit<TypeDefaultItemProps, "index"> {
|
|
46
|
+
children: React.ReactNode;
|
|
47
|
+
disabled?: boolean;
|
|
48
|
+
role?: TypeMenuItemRoles;
|
|
49
|
+
$highlighted?: boolean;
|
|
59
50
|
active?: boolean;
|
|
60
51
|
inputType?: InputType;
|
|
61
|
-
|
|
52
|
+
inputLabelId?: string;
|
|
62
53
|
}
|
|
63
54
|
|
|
64
|
-
|
|
65
|
-
* SelectionIndicator - handles logic for appropriate rendering of inputs
|
|
66
|
-
* @returns Checkbox | Icon | Radio | Switch
|
|
67
|
-
*/
|
|
68
|
-
declare const SelectionIndicator: ({ id, inputType, "aria-labelledby": labeledBy, selected, }: {
|
|
69
|
-
id: string;
|
|
70
|
-
"aria-labelledby": string;
|
|
71
|
-
selected: boolean;
|
|
72
|
-
inputType: InputType;
|
|
73
|
-
}) => react_jsx_runtime.JSX.Element | null;
|
|
74
|
-
/**
|
|
75
|
-
* MenuItemSelectable - primitive with controlled input states
|
|
76
|
-
*/
|
|
77
|
-
declare const MenuItemSelectable: ({ id, children, inputType, inputLabel, ...props }: TypeMenuItemSelectableProps) => react_jsx_runtime.JSX.Element;
|
|
55
|
+
declare const MenuItem: ({ id, children, onClick, onKeyDown, disabled, ref, href, color, ...props }: TypeMenuItemProps) => react_jsx_runtime.JSX.Element;
|
|
78
56
|
|
|
79
|
-
declare const
|
|
80
|
-
declare const
|
|
81
|
-
|
|
57
|
+
declare const MenuItemContainer: styled_components.StyledComponent<"li", styled_components.DefaultTheme, {}, never>;
|
|
58
|
+
declare const StyledMenuItem: styled_components.StyledComponent<"div", styled_components.DefaultTheme, {
|
|
59
|
+
$highlighted: boolean;
|
|
60
|
+
}, never>;
|
|
61
|
+
declare const MenuItemRow: styled_components.StyledComponent<"div", styled_components.DefaultTheme, {}, never>;
|
|
62
|
+
declare const MenuItemAction: styled_components.StyledComponent<"div", styled_components.DefaultTheme, {}, never>;
|
|
63
|
+
declare const MenuItemText: styled_components.StyledComponent<"div", styled_components.DefaultTheme, {}, never>;
|
|
82
64
|
|
|
83
65
|
interface TypeMenuHeaderProps extends Omit<React$1.ComponentPropsWithoutRef<"div">, "color">, TypeStyledComponentsCommonProps, TypeBorderSystemProps, TypeColorSystemProps, TypeFlexboxSystemProps, TypeGridSystemProps, TypeLayoutSystemProps, TypeSpaceSystemProps, TypePositionSystemProps {
|
|
84
66
|
title?: string;
|
|
@@ -86,14 +68,50 @@ interface TypeMenuHeaderProps extends Omit<React$1.ComponentPropsWithoutRef<"div
|
|
|
86
68
|
rightAction?: React$1.ReactNode;
|
|
87
69
|
}
|
|
88
70
|
|
|
71
|
+
/**
|
|
72
|
+
* @link https://seeds.sproutsocial.com/components/menu-header/
|
|
73
|
+
*
|
|
74
|
+
* @description MenuHeader is a container used to hold header content within a Menu.
|
|
75
|
+
*
|
|
76
|
+
* @see {@link https://seeds.sproutsocial.com/components/menu-footer/ | MenuFooter}
|
|
77
|
+
*/
|
|
89
78
|
declare const MenuHeader: ({ children, title, leftAction, rightAction, ...rest }: TypeMenuHeaderProps) => react_jsx_runtime.JSX.Element;
|
|
90
79
|
|
|
91
|
-
interface TypeMenuContentProps extends
|
|
80
|
+
interface TypeMenuContentProps extends HTMLMotionProps<"ul"> {
|
|
92
81
|
children: ReactNode;
|
|
93
82
|
}
|
|
94
83
|
|
|
84
|
+
/**
|
|
85
|
+
* @link https://seeds.sproutsocial.com/components/menu-content/
|
|
86
|
+
*
|
|
87
|
+
* @description MenuContent is used to contain lists or grouped lists of {@link https://github.com/sproutsocial/seeds/tree/dev/seeds-react/seeds-react-menu/src/MenuItem | MenuItems}.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* <ActionMenu>
|
|
91
|
+
* <MenuHeader>Header</MenuHeader>
|
|
92
|
+
* <MenuContent>
|
|
93
|
+
* <MenuGroup>
|
|
94
|
+
* <MenuItem>Item 1</MenuItem>
|
|
95
|
+
* </MenuGroup>
|
|
96
|
+
* <MenuGroup>
|
|
97
|
+
* <MenuItem>Item 2</MenuItem>
|
|
98
|
+
* </MenuGroup>
|
|
99
|
+
* </MenuContent>
|
|
100
|
+
* <MenuFooter>Footer</MenuFooter>
|
|
101
|
+
* </ActionMenu>
|
|
102
|
+
*
|
|
103
|
+
* @see {@link https://seeds.sproutsocial.com/components/menu-item/ | MenuItem}
|
|
104
|
+
* @see {@link https://seeds.sproutsocial.com/components/menu-group/ | MenuGroup}
|
|
105
|
+
*/
|
|
95
106
|
declare const MenuContent: ({ id, children, ...rest }: TypeMenuContentProps) => react_jsx_runtime.JSX.Element;
|
|
96
107
|
|
|
108
|
+
/**
|
|
109
|
+
* @link https://seeds.sproutsocial.com/components/menu-footer/
|
|
110
|
+
*
|
|
111
|
+
* @description MenuFooter is a container used to hold footer content within a Menu.
|
|
112
|
+
*
|
|
113
|
+
* @see {@link https://seeds.sproutsocial.com/components/menu-header/ | MenuHeader}
|
|
114
|
+
*/
|
|
97
115
|
declare const MenuFooter: ({ children, ...rest }: TypeBoxProps) => react_jsx_runtime.JSX.Element;
|
|
98
116
|
|
|
99
117
|
interface TypeMenuGroupStyledProps extends TypeBorderSystemProps, TypeColorSystemProps, TypeFlexboxSystemProps, TypeGridSystemProps, TypeLayoutSystemProps, TypePositionSystemProps, TypeSpaceSystemProps, TypeTypographySystemProps {
|
|
@@ -104,6 +122,25 @@ interface TypeMenuGroupProps extends TypeMenuGroupStyledProps, Omit<React.Compon
|
|
|
104
122
|
titleAs?: string | React.ComponentType<any>;
|
|
105
123
|
}
|
|
106
124
|
|
|
125
|
+
/**
|
|
126
|
+
* @link https://seeds.sproutsocial.com/components/menu-group/
|
|
127
|
+
*
|
|
128
|
+
* @description MenuGroup is used to group lists of {@link https://github.com/sproutsocial/seeds/tree/dev/seeds-react/seeds-react-menu/src/MenuItem | MenuItems}.
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* <ActionMenu>
|
|
132
|
+
* <MenuContent>
|
|
133
|
+
* <MenuGroup title="Group 1">
|
|
134
|
+
* <MenuItem>Item 1</MenuItem>
|
|
135
|
+
* </MenuGroup>
|
|
136
|
+
* <MenuGroup title="Group 1">
|
|
137
|
+
* <MenuItem>Item 2</MenuItem>
|
|
138
|
+
* </MenuGroup>
|
|
139
|
+
* </MenuContent>
|
|
140
|
+
* </ActionMenu>
|
|
141
|
+
*
|
|
142
|
+
* @see {@link https://seeds.sproutsocial.com/components/menu-item/ | MenuItem}
|
|
143
|
+
*/
|
|
107
144
|
declare const MenuGroup: ({ titleAs, children, title, color, ...rest }: TypeMenuGroupProps) => react_jsx_runtime.JSX.Element;
|
|
108
145
|
|
|
109
146
|
declare const StyledMenuGroup: styled_components.StyledComponent<"li", styled_components.DefaultTheme, TypeMenuGroupProps, never>;
|
|
@@ -145,13 +182,18 @@ declare const MenuProvider: ({ children, ...overrides }: TypeMenuProviderProps)
|
|
|
145
182
|
declare const useMenuContext: () => TypeMenuContext;
|
|
146
183
|
|
|
147
184
|
interface TypeMenuRootOwnProps {
|
|
148
|
-
|
|
185
|
+
menuToggleElement: React__default.ReactElement<any>;
|
|
149
186
|
popoutProps?: Partial<Omit<TypePopoutProps, "isOpen" | "setIsOpen" | "content" | "children">>;
|
|
150
187
|
width?: TypePopoutProps["width"];
|
|
151
188
|
}
|
|
152
189
|
interface TypeMenuRootProps extends Partial<TypeMenuProviderProps>, TypeMenuRootOwnProps {
|
|
153
190
|
}
|
|
154
|
-
|
|
191
|
+
/**
|
|
192
|
+
* @link https://seeds.sproutsocial.com/components/menu-root/
|
|
193
|
+
*
|
|
194
|
+
* @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.
|
|
195
|
+
*/
|
|
196
|
+
declare const MenuRoot: ({ children, menuToggleElement, popoutProps, width, ...contextProps }: TypeMenuRootProps) => react_jsx_runtime.JSX.Element;
|
|
155
197
|
|
|
156
198
|
declare const MenuLabel: ({ children, ...rest }: TypeTextProps) => react_jsx_runtime.JSX.Element;
|
|
157
199
|
|
|
@@ -164,18 +206,42 @@ type TypeInvalidMenuProps = "initialSelectedItem" | "defaultSelectedItem" | "sel
|
|
|
164
206
|
interface TypeActionMenuProps extends TypeMenuRootOwnProps, Partial<Omit<UseSelectProps<TypeDefaultItemProps>, TypeInvalidMenuProps>> {
|
|
165
207
|
children: TypeMenuRootProps["children"];
|
|
166
208
|
}
|
|
209
|
+
/**
|
|
210
|
+
* @link https://seeds.sproutsocial.com/components/action-menu/
|
|
211
|
+
*
|
|
212
|
+
* @description An ActionMenu contains a list of clickable items like buttons or links. ActionMenus do not hold a selection.
|
|
213
|
+
*
|
|
214
|
+
* **To select menu items:**
|
|
215
|
+
* @see {@link https://github.com/sproutsocial/seeds/tree/dev/seeds-react/seeds-react-menu/src/SingleSelectMenu | SingleSelectMenu}
|
|
216
|
+
* @see {@link https://github.com/sproutsocial/seeds/tree/dev/seeds-react/seeds-react-menu/src/MultiSelectMenu | MultiSelectMenu}
|
|
217
|
+
*/
|
|
167
218
|
declare const ActionMenu: ({ children, stateReducer: externalStateReducer, ...useSelectProps }: TypeActionMenuProps) => react_jsx_runtime.JSX.Element;
|
|
168
219
|
|
|
169
220
|
interface TypeSingleSelectMenuProps extends TypeMenuRootOwnProps, Partial<UseSelectProps<TypeDefaultItemProps>> {
|
|
170
221
|
children: TypeMenuRootProps["children"];
|
|
171
222
|
}
|
|
172
223
|
|
|
224
|
+
/**
|
|
225
|
+
* @link https://seeds.sproutsocial.com/components/singleselect-menu/
|
|
226
|
+
*
|
|
227
|
+
* @description A SingleSelectMenu allows a single selection of a {@link https://github.com/sproutsocial/seeds/tree/dev/seeds-react/seeds-react-menu/src/MenuItem | MenuItem} from a list or groups or lists.
|
|
228
|
+
*
|
|
229
|
+
* **To trigger actions from a menu:**
|
|
230
|
+
* @see {@link https://github.com/sproutsocial/seeds/tree/dev/seeds-react/seeds-react-menu/src/ActionMenu | ActionMenu}
|
|
231
|
+
*/
|
|
173
232
|
declare const SingleSelectMenu: ({ children, stateReducer: externalStateReducer, ...useSelectProps }: TypeSingleSelectMenuProps) => react_jsx_runtime.JSX.Element;
|
|
174
233
|
|
|
175
234
|
interface TypeMultiSelectMenuProps extends TypeMenuRootOwnProps, TypeDownshiftMultiSelectProps {
|
|
176
235
|
children: TypeMenuRootProps["children"];
|
|
177
236
|
}
|
|
178
237
|
|
|
238
|
+
/**
|
|
239
|
+
* @link https://seeds.sproutsocial.com/components/multiselect-menu/
|
|
240
|
+
*
|
|
241
|
+
* @description A MultiSelectMenu allows multiple {@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.
|
|
242
|
+
*
|
|
243
|
+
* @see {@link https://seeds.sproutsocial.com/components/menu-group/ | MenuGroup}
|
|
244
|
+
*/
|
|
179
245
|
declare const MultiSelectMenu: ({ children, stateReducer: externalStateReducer, getA11yMultiStatusMessage, onMultiSelectStateChange, multiSelectStateReducer, ...useSelectProps }: TypeMultiSelectMenuProps) => react_jsx_runtime.JSX.Element;
|
|
180
246
|
|
|
181
247
|
interface TypeUseItemsFromChildrenProps {
|
|
@@ -194,4 +260,4 @@ declare const defaultUseSelectProps: {
|
|
|
194
260
|
isItemDisabled: (item: any) => boolean;
|
|
195
261
|
};
|
|
196
262
|
|
|
197
|
-
export { ActionMenu, INPUT_TYPES, type InputType, MenuContent, MenuContext, MenuFooter, MenuGroup, MenuHeader, MenuItem,
|
|
263
|
+
export { ActionMenu, INPUT_TYPES, type InputType, MenuContent, MenuContext, MenuFooter, MenuGroup, MenuHeader, MenuItem, MenuItemAction, MenuItemContainer, MenuItemRow, MenuItemText, MenuLabel, MenuProvider, MenuRoot, MenuToggleButton, MultiSelectMenu, SingleSelectMenu, StyledMenuGroup, StyledMenuGroupUl, StyledMenuItem, StyledTitle, type TypeActionMenuProps, type TypeDownshiftMultiSelectProps, type TypeMenuContentProps, type TypeMenuContext, type TypeMenuContextProps, type TypeMenuGroupProps, type TypeMenuGroupStyledProps, type TypeMenuHeaderProps, type TypeMenuItemProps, type TypeMenuItemStyledProps, type TypeMenuProviderProps, type TypeMenuRootOwnProps, type TypeMenuRootProps, type TypeMenuToggleButtonProps, type TypeSingleSelectMenuProps, type TypeUseItemsFromChildrenProps, defaultUseSelectProps, useItemsFromChildren, useMenu, useMenuContext, useSelectStateReducer };
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { TypeBorderSystemProps, TypeColorSystemProps, TypeFlexboxSystemProps, Ty
|
|
|
5
5
|
import * as styled_components from 'styled-components';
|
|
6
6
|
import * as React$1 from 'react';
|
|
7
7
|
import React__default, { ReactNode } from 'react';
|
|
8
|
+
import { HTMLMotionProps } from 'motion/react';
|
|
8
9
|
import { TypeBoxProps } from '@sproutsocial/seeds-react-box';
|
|
9
10
|
export { TypeBoxProps as TypeMenuFooterProps } from '@sproutsocial/seeds-react-box';
|
|
10
11
|
import * as _sproutsocial_seeds_react_text from '@sproutsocial/seeds-react-text';
|
|
@@ -34,20 +35,6 @@ type TypeNotEmptyChildren = React.ReactChild | React.ReactFragment | React.React
|
|
|
34
35
|
|
|
35
36
|
interface TypeMenuItemStyledProps extends TypeBorderSystemProps, TypeColorSystemProps, TypeFlexboxSystemProps, TypeGridSystemProps, TypeLayoutSystemProps, TypePositionSystemProps, TypeSpaceSystemProps, TypeTypographySystemProps {
|
|
36
37
|
}
|
|
37
|
-
interface TypeMenuItemProps extends TypeMenuItemStyledProps, Omit<GetItemPropsOptions<TypeDefaultItemProps>, "as" | "item" | keyof TypeMenuItemStyledProps | keyof TypeDefaultItemProps>, Omit<TypeDefaultItemProps, "index"> {
|
|
38
|
-
label?: string;
|
|
39
|
-
children: React.ReactNode;
|
|
40
|
-
disabled?: boolean;
|
|
41
|
-
role?: TypeMenuItemRoles;
|
|
42
|
-
$highlighted?: boolean;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
declare const MenuItem: ({ id, children, role, label, onClick, onKeyDown, disabled, ref, color, ...props }: TypeMenuItemProps) => react_jsx_runtime.JSX.Element;
|
|
46
|
-
|
|
47
|
-
declare const MenuItemContainer: styled_components.StyledComponent<"li", styled_components.DefaultTheme, {
|
|
48
|
-
$highlighted: boolean;
|
|
49
|
-
}, never>;
|
|
50
|
-
|
|
51
38
|
declare const INPUT_TYPES: {
|
|
52
39
|
readonly CHECKBOX: "checkbox";
|
|
53
40
|
readonly RADIO: "radio";
|
|
@@ -55,30 +42,25 @@ declare const INPUT_TYPES: {
|
|
|
55
42
|
readonly ICON: "icon";
|
|
56
43
|
};
|
|
57
44
|
type InputType = (typeof INPUT_TYPES)[keyof typeof INPUT_TYPES];
|
|
58
|
-
interface
|
|
45
|
+
interface TypeMenuItemProps extends TypeMenuItemStyledProps, Omit<GetItemPropsOptions<TypeDefaultItemProps>, "as" | "item" | keyof TypeMenuItemStyledProps | keyof TypeDefaultItemProps>, Omit<TypeDefaultItemProps, "index"> {
|
|
46
|
+
children: React.ReactNode;
|
|
47
|
+
disabled?: boolean;
|
|
48
|
+
role?: TypeMenuItemRoles;
|
|
49
|
+
$highlighted?: boolean;
|
|
59
50
|
active?: boolean;
|
|
60
51
|
inputType?: InputType;
|
|
61
|
-
|
|
52
|
+
inputLabelId?: string;
|
|
62
53
|
}
|
|
63
54
|
|
|
64
|
-
|
|
65
|
-
* SelectionIndicator - handles logic for appropriate rendering of inputs
|
|
66
|
-
* @returns Checkbox | Icon | Radio | Switch
|
|
67
|
-
*/
|
|
68
|
-
declare const SelectionIndicator: ({ id, inputType, "aria-labelledby": labeledBy, selected, }: {
|
|
69
|
-
id: string;
|
|
70
|
-
"aria-labelledby": string;
|
|
71
|
-
selected: boolean;
|
|
72
|
-
inputType: InputType;
|
|
73
|
-
}) => react_jsx_runtime.JSX.Element | null;
|
|
74
|
-
/**
|
|
75
|
-
* MenuItemSelectable - primitive with controlled input states
|
|
76
|
-
*/
|
|
77
|
-
declare const MenuItemSelectable: ({ id, children, inputType, inputLabel, ...props }: TypeMenuItemSelectableProps) => react_jsx_runtime.JSX.Element;
|
|
55
|
+
declare const MenuItem: ({ id, children, onClick, onKeyDown, disabled, ref, href, color, ...props }: TypeMenuItemProps) => react_jsx_runtime.JSX.Element;
|
|
78
56
|
|
|
79
|
-
declare const
|
|
80
|
-
declare const
|
|
81
|
-
|
|
57
|
+
declare const MenuItemContainer: styled_components.StyledComponent<"li", styled_components.DefaultTheme, {}, never>;
|
|
58
|
+
declare const StyledMenuItem: styled_components.StyledComponent<"div", styled_components.DefaultTheme, {
|
|
59
|
+
$highlighted: boolean;
|
|
60
|
+
}, never>;
|
|
61
|
+
declare const MenuItemRow: styled_components.StyledComponent<"div", styled_components.DefaultTheme, {}, never>;
|
|
62
|
+
declare const MenuItemAction: styled_components.StyledComponent<"div", styled_components.DefaultTheme, {}, never>;
|
|
63
|
+
declare const MenuItemText: styled_components.StyledComponent<"div", styled_components.DefaultTheme, {}, never>;
|
|
82
64
|
|
|
83
65
|
interface TypeMenuHeaderProps extends Omit<React$1.ComponentPropsWithoutRef<"div">, "color">, TypeStyledComponentsCommonProps, TypeBorderSystemProps, TypeColorSystemProps, TypeFlexboxSystemProps, TypeGridSystemProps, TypeLayoutSystemProps, TypeSpaceSystemProps, TypePositionSystemProps {
|
|
84
66
|
title?: string;
|
|
@@ -86,14 +68,50 @@ interface TypeMenuHeaderProps extends Omit<React$1.ComponentPropsWithoutRef<"div
|
|
|
86
68
|
rightAction?: React$1.ReactNode;
|
|
87
69
|
}
|
|
88
70
|
|
|
71
|
+
/**
|
|
72
|
+
* @link https://seeds.sproutsocial.com/components/menu-header/
|
|
73
|
+
*
|
|
74
|
+
* @description MenuHeader is a container used to hold header content within a Menu.
|
|
75
|
+
*
|
|
76
|
+
* @see {@link https://seeds.sproutsocial.com/components/menu-footer/ | MenuFooter}
|
|
77
|
+
*/
|
|
89
78
|
declare const MenuHeader: ({ children, title, leftAction, rightAction, ...rest }: TypeMenuHeaderProps) => react_jsx_runtime.JSX.Element;
|
|
90
79
|
|
|
91
|
-
interface TypeMenuContentProps extends
|
|
80
|
+
interface TypeMenuContentProps extends HTMLMotionProps<"ul"> {
|
|
92
81
|
children: ReactNode;
|
|
93
82
|
}
|
|
94
83
|
|
|
84
|
+
/**
|
|
85
|
+
* @link https://seeds.sproutsocial.com/components/menu-content/
|
|
86
|
+
*
|
|
87
|
+
* @description MenuContent is used to contain lists or grouped lists of {@link https://github.com/sproutsocial/seeds/tree/dev/seeds-react/seeds-react-menu/src/MenuItem | MenuItems}.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* <ActionMenu>
|
|
91
|
+
* <MenuHeader>Header</MenuHeader>
|
|
92
|
+
* <MenuContent>
|
|
93
|
+
* <MenuGroup>
|
|
94
|
+
* <MenuItem>Item 1</MenuItem>
|
|
95
|
+
* </MenuGroup>
|
|
96
|
+
* <MenuGroup>
|
|
97
|
+
* <MenuItem>Item 2</MenuItem>
|
|
98
|
+
* </MenuGroup>
|
|
99
|
+
* </MenuContent>
|
|
100
|
+
* <MenuFooter>Footer</MenuFooter>
|
|
101
|
+
* </ActionMenu>
|
|
102
|
+
*
|
|
103
|
+
* @see {@link https://seeds.sproutsocial.com/components/menu-item/ | MenuItem}
|
|
104
|
+
* @see {@link https://seeds.sproutsocial.com/components/menu-group/ | MenuGroup}
|
|
105
|
+
*/
|
|
95
106
|
declare const MenuContent: ({ id, children, ...rest }: TypeMenuContentProps) => react_jsx_runtime.JSX.Element;
|
|
96
107
|
|
|
108
|
+
/**
|
|
109
|
+
* @link https://seeds.sproutsocial.com/components/menu-footer/
|
|
110
|
+
*
|
|
111
|
+
* @description MenuFooter is a container used to hold footer content within a Menu.
|
|
112
|
+
*
|
|
113
|
+
* @see {@link https://seeds.sproutsocial.com/components/menu-header/ | MenuHeader}
|
|
114
|
+
*/
|
|
97
115
|
declare const MenuFooter: ({ children, ...rest }: TypeBoxProps) => react_jsx_runtime.JSX.Element;
|
|
98
116
|
|
|
99
117
|
interface TypeMenuGroupStyledProps extends TypeBorderSystemProps, TypeColorSystemProps, TypeFlexboxSystemProps, TypeGridSystemProps, TypeLayoutSystemProps, TypePositionSystemProps, TypeSpaceSystemProps, TypeTypographySystemProps {
|
|
@@ -104,6 +122,25 @@ interface TypeMenuGroupProps extends TypeMenuGroupStyledProps, Omit<React.Compon
|
|
|
104
122
|
titleAs?: string | React.ComponentType<any>;
|
|
105
123
|
}
|
|
106
124
|
|
|
125
|
+
/**
|
|
126
|
+
* @link https://seeds.sproutsocial.com/components/menu-group/
|
|
127
|
+
*
|
|
128
|
+
* @description MenuGroup is used to group lists of {@link https://github.com/sproutsocial/seeds/tree/dev/seeds-react/seeds-react-menu/src/MenuItem | MenuItems}.
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* <ActionMenu>
|
|
132
|
+
* <MenuContent>
|
|
133
|
+
* <MenuGroup title="Group 1">
|
|
134
|
+
* <MenuItem>Item 1</MenuItem>
|
|
135
|
+
* </MenuGroup>
|
|
136
|
+
* <MenuGroup title="Group 1">
|
|
137
|
+
* <MenuItem>Item 2</MenuItem>
|
|
138
|
+
* </MenuGroup>
|
|
139
|
+
* </MenuContent>
|
|
140
|
+
* </ActionMenu>
|
|
141
|
+
*
|
|
142
|
+
* @see {@link https://seeds.sproutsocial.com/components/menu-item/ | MenuItem}
|
|
143
|
+
*/
|
|
107
144
|
declare const MenuGroup: ({ titleAs, children, title, color, ...rest }: TypeMenuGroupProps) => react_jsx_runtime.JSX.Element;
|
|
108
145
|
|
|
109
146
|
declare const StyledMenuGroup: styled_components.StyledComponent<"li", styled_components.DefaultTheme, TypeMenuGroupProps, never>;
|
|
@@ -145,13 +182,18 @@ declare const MenuProvider: ({ children, ...overrides }: TypeMenuProviderProps)
|
|
|
145
182
|
declare const useMenuContext: () => TypeMenuContext;
|
|
146
183
|
|
|
147
184
|
interface TypeMenuRootOwnProps {
|
|
148
|
-
|
|
185
|
+
menuToggleElement: React__default.ReactElement<any>;
|
|
149
186
|
popoutProps?: Partial<Omit<TypePopoutProps, "isOpen" | "setIsOpen" | "content" | "children">>;
|
|
150
187
|
width?: TypePopoutProps["width"];
|
|
151
188
|
}
|
|
152
189
|
interface TypeMenuRootProps extends Partial<TypeMenuProviderProps>, TypeMenuRootOwnProps {
|
|
153
190
|
}
|
|
154
|
-
|
|
191
|
+
/**
|
|
192
|
+
* @link https://seeds.sproutsocial.com/components/menu-root/
|
|
193
|
+
*
|
|
194
|
+
* @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.
|
|
195
|
+
*/
|
|
196
|
+
declare const MenuRoot: ({ children, menuToggleElement, popoutProps, width, ...contextProps }: TypeMenuRootProps) => react_jsx_runtime.JSX.Element;
|
|
155
197
|
|
|
156
198
|
declare const MenuLabel: ({ children, ...rest }: TypeTextProps) => react_jsx_runtime.JSX.Element;
|
|
157
199
|
|
|
@@ -164,18 +206,42 @@ type TypeInvalidMenuProps = "initialSelectedItem" | "defaultSelectedItem" | "sel
|
|
|
164
206
|
interface TypeActionMenuProps extends TypeMenuRootOwnProps, Partial<Omit<UseSelectProps<TypeDefaultItemProps>, TypeInvalidMenuProps>> {
|
|
165
207
|
children: TypeMenuRootProps["children"];
|
|
166
208
|
}
|
|
209
|
+
/**
|
|
210
|
+
* @link https://seeds.sproutsocial.com/components/action-menu/
|
|
211
|
+
*
|
|
212
|
+
* @description An ActionMenu contains a list of clickable items like buttons or links. ActionMenus do not hold a selection.
|
|
213
|
+
*
|
|
214
|
+
* **To select menu items:**
|
|
215
|
+
* @see {@link https://github.com/sproutsocial/seeds/tree/dev/seeds-react/seeds-react-menu/src/SingleSelectMenu | SingleSelectMenu}
|
|
216
|
+
* @see {@link https://github.com/sproutsocial/seeds/tree/dev/seeds-react/seeds-react-menu/src/MultiSelectMenu | MultiSelectMenu}
|
|
217
|
+
*/
|
|
167
218
|
declare const ActionMenu: ({ children, stateReducer: externalStateReducer, ...useSelectProps }: TypeActionMenuProps) => react_jsx_runtime.JSX.Element;
|
|
168
219
|
|
|
169
220
|
interface TypeSingleSelectMenuProps extends TypeMenuRootOwnProps, Partial<UseSelectProps<TypeDefaultItemProps>> {
|
|
170
221
|
children: TypeMenuRootProps["children"];
|
|
171
222
|
}
|
|
172
223
|
|
|
224
|
+
/**
|
|
225
|
+
* @link https://seeds.sproutsocial.com/components/singleselect-menu/
|
|
226
|
+
*
|
|
227
|
+
* @description A SingleSelectMenu allows a single selection of a {@link https://github.com/sproutsocial/seeds/tree/dev/seeds-react/seeds-react-menu/src/MenuItem | MenuItem} from a list or groups or lists.
|
|
228
|
+
*
|
|
229
|
+
* **To trigger actions from a menu:**
|
|
230
|
+
* @see {@link https://github.com/sproutsocial/seeds/tree/dev/seeds-react/seeds-react-menu/src/ActionMenu | ActionMenu}
|
|
231
|
+
*/
|
|
173
232
|
declare const SingleSelectMenu: ({ children, stateReducer: externalStateReducer, ...useSelectProps }: TypeSingleSelectMenuProps) => react_jsx_runtime.JSX.Element;
|
|
174
233
|
|
|
175
234
|
interface TypeMultiSelectMenuProps extends TypeMenuRootOwnProps, TypeDownshiftMultiSelectProps {
|
|
176
235
|
children: TypeMenuRootProps["children"];
|
|
177
236
|
}
|
|
178
237
|
|
|
238
|
+
/**
|
|
239
|
+
* @link https://seeds.sproutsocial.com/components/multiselect-menu/
|
|
240
|
+
*
|
|
241
|
+
* @description A MultiSelectMenu allows multiple {@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.
|
|
242
|
+
*
|
|
243
|
+
* @see {@link https://seeds.sproutsocial.com/components/menu-group/ | MenuGroup}
|
|
244
|
+
*/
|
|
179
245
|
declare const MultiSelectMenu: ({ children, stateReducer: externalStateReducer, getA11yMultiStatusMessage, onMultiSelectStateChange, multiSelectStateReducer, ...useSelectProps }: TypeMultiSelectMenuProps) => react_jsx_runtime.JSX.Element;
|
|
180
246
|
|
|
181
247
|
interface TypeUseItemsFromChildrenProps {
|
|
@@ -194,4 +260,4 @@ declare const defaultUseSelectProps: {
|
|
|
194
260
|
isItemDisabled: (item: any) => boolean;
|
|
195
261
|
};
|
|
196
262
|
|
|
197
|
-
export { ActionMenu, INPUT_TYPES, type InputType, MenuContent, MenuContext, MenuFooter, MenuGroup, MenuHeader, MenuItem,
|
|
263
|
+
export { ActionMenu, INPUT_TYPES, type InputType, MenuContent, MenuContext, MenuFooter, MenuGroup, MenuHeader, MenuItem, MenuItemAction, MenuItemContainer, MenuItemRow, MenuItemText, MenuLabel, MenuProvider, MenuRoot, MenuToggleButton, MultiSelectMenu, SingleSelectMenu, StyledMenuGroup, StyledMenuGroupUl, StyledMenuItem, StyledTitle, type TypeActionMenuProps, type TypeDownshiftMultiSelectProps, type TypeMenuContentProps, type TypeMenuContext, type TypeMenuContextProps, type TypeMenuGroupProps, type TypeMenuGroupStyledProps, type TypeMenuHeaderProps, type TypeMenuItemProps, type TypeMenuItemStyledProps, type TypeMenuProviderProps, type TypeMenuRootOwnProps, type TypeMenuRootProps, type TypeMenuToggleButtonProps, type TypeSingleSelectMenuProps, type TypeUseItemsFromChildrenProps, defaultUseSelectProps, useItemsFromChildren, useMenu, useMenuContext, useSelectStateReducer };
|