@sproutsocial/seeds-react-menu 0.2.1 → 0.2.3
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/.eslintrc.js +2 -6
- package/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +13 -0
- package/dist/esm/index.js +12 -12
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +34 -12
- package/dist/index.d.ts +34 -12
- package/dist/index.js +7 -11
- package/dist/index.js.map +1 -1
- package/package.json +3 -5
- package/src/ActionMenu/ActionMenu.tsx +4 -19
- package/src/ActionMenu/ActionMenuTypes.ts +12 -0
- package/src/ActionMenu/index.ts +1 -0
- package/src/{ComboBox/ComboBox.feature → Autocomplete/Autocomplete.feature} +16 -16
- package/src/Autocomplete/Autocomplete.tsx +65 -0
- package/src/Autocomplete/AutocompleteTypes.ts +8 -0
- package/src/Autocomplete/__tests__/Autocomplete.test.tsx +113 -0
- package/src/Autocomplete/__tests__/Autocomplete.typetest.tsx +78 -0
- package/src/Autocomplete/index.ts +2 -0
- package/src/MenuContent/MenuContent.tsx +1 -1
- package/src/MenuContent/MenuContentTypes.ts +2 -1
- package/src/MenuContext.tsx +71 -10
- package/src/MenuGroup/MenuGroupTypes.ts +0 -1
- package/src/MenuGroup/__tests__/MenuGroup.test.tsx +0 -1
- package/src/MenuHeader/__tests__/MenuHeader.typetest.tsx +0 -1
- package/src/MenuItem/MenuItem.tsx +0 -4
- package/src/MenuItem/__tests__/MenuItem.test.tsx +4 -1
- package/src/MenuItem/styles.tsx +1 -1
- package/src/MenuItem/useOptionProps.tsx +0 -1
- package/src/MenuRoot/MenuRoot.tsx +2 -2
- package/src/MenuRoot/__tests__/MenuRoot.test.tsx +1 -2
- package/src/MultiSelectMenu/MultiSelectMenu.tsx +0 -1
- package/src/MultiSelectMenu/MultiSelectMenuTypes.ts +5 -1
- package/src/MultiSelectMenu/__tests__/MultiSelectMenu.test.tsx +5 -2
- package/src/MultiSelectMenu/index.ts +1 -0
- package/src/SingleSelectMenu/SingleSelectMenu.tsx +0 -1
- package/src/SingleSelectMenu/SingleSelectMenuTypes.ts +2 -3
- package/src/hooks/useItemsFromChildren.tsx +7 -5
- package/src/index.ts +1 -0
- package/src/reducers/useComboboxStateReducer.tsx +26 -0
- package/src/types.ts +2 -5
- package/tsconfig.json +1 -1
- package/.eslintignore +0 -6
- package/src/ComboBox/TokenInput.feature +0 -84
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as downshift from 'downshift';
|
|
3
|
-
import { GetItemPropsOptions, UseSelectProps, UseMultipleSelectionProps, UseSelectReturnValue, UseMultipleSelectionReturnValue } from 'downshift';
|
|
3
|
+
import { GetItemPropsOptions, UseComboboxProps, UseSelectProps, UseMultipleSelectionProps, UseComboboxReturnValue, UseSelectReturnValue, UseMultipleSelectionReturnValue } from 'downshift';
|
|
4
4
|
import { TypeBorderSystemProps, TypeColorSystemProps, TypeFlexboxSystemProps, TypeGridSystemProps, TypeLayoutSystemProps, TypePositionSystemProps, TypeSpaceSystemProps, TypeTypographySystemProps, TypeStyledComponentsCommonProps } from '@sproutsocial/seeds-react-system-props';
|
|
5
5
|
import * as styled_components from 'styled-components';
|
|
6
6
|
import * as React$1 from 'react';
|
|
@@ -22,14 +22,11 @@ declare const MENU_ITEM_ROLES: {
|
|
|
22
22
|
};
|
|
23
23
|
type TypeMenuItemRoles = (typeof MENU_ITEM_ROLES)[keyof typeof MENU_ITEM_ROLES];
|
|
24
24
|
|
|
25
|
-
interface
|
|
26
|
-
element: React.ReactElement<TypeMenuItemProps>;
|
|
27
|
-
parents: readonly React.ReactNode[];
|
|
28
|
-
}
|
|
29
|
-
interface TypeDefaultItemProps extends Partial<TypeItemElements> {
|
|
25
|
+
interface TypeDefaultItemProps {
|
|
30
26
|
id: string;
|
|
31
27
|
index: number;
|
|
32
28
|
disabled?: boolean;
|
|
29
|
+
menuItemProps?: TypeMenuItemProps;
|
|
33
30
|
}
|
|
34
31
|
type TypeNotEmptyChildren = React.ReactChild | React.ReactFragment | React.ReactPortal;
|
|
35
32
|
|
|
@@ -147,14 +144,34 @@ declare const StyledMenuGroup: styled_components.StyledComponent<"li", styled_co
|
|
|
147
144
|
declare const StyledTitle: styled_components.StyledComponent<React$1.FC<_sproutsocial_seeds_react_text.TypeTextProps>, styled_components.DefaultTheme, {}, never>;
|
|
148
145
|
declare const StyledMenuGroupUl: styled_components.StyledComponent<"ul", styled_components.DefaultTheme, {}, never>;
|
|
149
146
|
|
|
150
|
-
interface
|
|
147
|
+
interface TypeDownshiftComboboxProps extends Partial<UseComboboxProps<TypeDefaultItemProps>> {
|
|
148
|
+
}
|
|
149
|
+
interface TypeDownshiftSelectProps extends Partial<UseSelectProps<TypeDefaultItemProps>> {
|
|
150
|
+
}
|
|
151
|
+
interface TypeDownshiftMultiSelectProps extends Partial<Omit<UseMultipleSelectionProps<TypeDefaultItemProps>, "stateReducer" | "onStateChange" | "getA11yStatusMessage">> {
|
|
151
152
|
getA11yMultiStatusMessage?: UseMultipleSelectionProps<TypeDefaultItemProps>["getA11yStatusMessage"];
|
|
152
153
|
onMultiSelectStateChange?: UseMultipleSelectionProps<TypeDefaultItemProps>["onStateChange"];
|
|
153
154
|
multiSelectStateReducer?: UseMultipleSelectionProps<TypeDefaultItemProps>["stateReducer"];
|
|
154
155
|
}
|
|
155
|
-
interface
|
|
156
|
+
interface TypeDownshiftComboboxReturnValue extends Partial<UseComboboxReturnValue<TypeDefaultItemProps>> {
|
|
157
|
+
}
|
|
158
|
+
interface TypeDownshiftSelectReturnValue extends Partial<UseSelectReturnValue<TypeDefaultItemProps>> {
|
|
159
|
+
}
|
|
160
|
+
interface TypeDownshiftMultiSelectReturnValue extends Partial<UseMultipleSelectionReturnValue<TypeDefaultItemProps>> {
|
|
161
|
+
}
|
|
162
|
+
type TypeDonwshiftSharedReturnValue = "getLabelProps" | "getToggleButtonProps" | "getMenuProps";
|
|
163
|
+
type TypeDonwshiftSharedProps = "onHighlightedIndexChange" | "onIsOpenChange" | "onSelectedItemChange" | "onStateChange" | "stateReducer";
|
|
164
|
+
interface TypeMenuContextProps extends Omit<TypeDownshiftComboboxReturnValue, TypeDonwshiftSharedReturnValue>, Omit<TypeDownshiftComboboxProps, TypeDonwshiftSharedProps>, Omit<TypeDownshiftSelectReturnValue, TypeDonwshiftSharedReturnValue>, Omit<TypeDownshiftSelectProps, TypeDonwshiftSharedProps>, TypeDownshiftMultiSelectReturnValue, TypeDownshiftMultiSelectProps {
|
|
156
165
|
items: TypeDefaultItemProps[];
|
|
157
166
|
isListbox?: boolean;
|
|
167
|
+
onHighlightedIndexChange?: TypeDownshiftComboboxProps["onHighlightedIndexChange"] | TypeDownshiftSelectProps["onHighlightedIndexChange"];
|
|
168
|
+
onIsOpenChange?: TypeDownshiftComboboxProps["onIsOpenChange"] | TypeDownshiftSelectProps["onIsOpenChange"];
|
|
169
|
+
onSelectedItemChange?: TypeDownshiftComboboxProps["onSelectedItemChange"] | TypeDownshiftSelectProps["onSelectedItemChange"];
|
|
170
|
+
onStateChange?: TypeDownshiftComboboxProps["onStateChange"] | TypeDownshiftSelectProps["onStateChange"];
|
|
171
|
+
stateReducer?: TypeDownshiftComboboxProps["stateReducer"] | TypeDownshiftSelectProps["stateReducer"];
|
|
172
|
+
getLabelProps?: TypeDownshiftComboboxReturnValue["getLabelProps"] | TypeDownshiftSelectReturnValue["getLabelProps"];
|
|
173
|
+
getToggleButtonProps?: TypeDownshiftComboboxReturnValue["getToggleButtonProps"] | TypeDownshiftSelectReturnValue["getToggleButtonProps"];
|
|
174
|
+
getMenuProps?: TypeDownshiftComboboxReturnValue["getMenuProps"] | TypeDownshiftSelectReturnValue["getMenuProps"];
|
|
158
175
|
}
|
|
159
176
|
interface TypeMenuContext extends TypeMenuContextProps {
|
|
160
177
|
itemsMap: {
|
|
@@ -203,9 +220,10 @@ interface TypeMenuToggleButtonProps extends Partial<TypeButtonProps> {
|
|
|
203
220
|
declare const MenuToggleButton: ({ children, ...rest }: TypeMenuToggleButtonProps) => react_jsx_runtime.JSX.Element;
|
|
204
221
|
|
|
205
222
|
type TypeInvalidMenuProps = "initialSelectedItem" | "defaultSelectedItem" | "selectedItem";
|
|
206
|
-
interface TypeActionMenuProps extends TypeMenuRootOwnProps,
|
|
223
|
+
interface TypeActionMenuProps extends TypeMenuRootOwnProps, Omit<TypeDownshiftSelectProps, TypeInvalidMenuProps> {
|
|
207
224
|
children: TypeMenuRootProps["children"];
|
|
208
225
|
}
|
|
226
|
+
|
|
209
227
|
/**
|
|
210
228
|
* @link https://seeds.sproutsocial.com/components/action-menu/
|
|
211
229
|
*
|
|
@@ -217,7 +235,7 @@ interface TypeActionMenuProps extends TypeMenuRootOwnProps, Partial<Omit<UseSele
|
|
|
217
235
|
*/
|
|
218
236
|
declare const ActionMenu: ({ children, stateReducer: externalStateReducer, ...useSelectProps }: TypeActionMenuProps) => react_jsx_runtime.JSX.Element;
|
|
219
237
|
|
|
220
|
-
interface TypeSingleSelectMenuProps extends TypeMenuRootOwnProps,
|
|
238
|
+
interface TypeSingleSelectMenuProps extends TypeMenuRootOwnProps, TypeDownshiftSelectProps {
|
|
221
239
|
children: TypeMenuRootProps["children"];
|
|
222
240
|
}
|
|
223
241
|
|
|
@@ -231,7 +249,7 @@ interface TypeSingleSelectMenuProps extends TypeMenuRootOwnProps, Partial<UseSel
|
|
|
231
249
|
*/
|
|
232
250
|
declare const SingleSelectMenu: ({ children, stateReducer: externalStateReducer, ...useSelectProps }: TypeSingleSelectMenuProps) => react_jsx_runtime.JSX.Element;
|
|
233
251
|
|
|
234
|
-
interface TypeMultiSelectMenuProps extends TypeMenuRootOwnProps, TypeDownshiftMultiSelectProps {
|
|
252
|
+
interface TypeMultiSelectMenuProps extends TypeMenuRootOwnProps, TypeDownshiftSelectProps, TypeDownshiftMultiSelectProps {
|
|
235
253
|
children: TypeMenuRootProps["children"];
|
|
236
254
|
}
|
|
237
255
|
|
|
@@ -247,6 +265,10 @@ declare const MultiSelectMenu: ({ children, stateReducer: externalStateReducer,
|
|
|
247
265
|
interface TypeUseItemsFromChildrenProps {
|
|
248
266
|
children: ReactNode;
|
|
249
267
|
}
|
|
268
|
+
interface TypeItemElements {
|
|
269
|
+
element: React__default.ReactElement<TypeMenuItemProps>;
|
|
270
|
+
parents: readonly React__default.ReactNode[];
|
|
271
|
+
}
|
|
250
272
|
declare const useItemsFromChildren: ({ children, }: TypeUseItemsFromChildrenProps) => {
|
|
251
273
|
allMenuItems: TypeDefaultItemProps[];
|
|
252
274
|
menuItemsMap: {
|
|
@@ -260,4 +282,4 @@ declare const defaultUseSelectProps: {
|
|
|
260
282
|
isItemDisabled: (item: any) => boolean;
|
|
261
283
|
};
|
|
262
284
|
|
|
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 };
|
|
285
|
+
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 TypeDefaultItemProps, type TypeDownshiftComboboxProps, type TypeDownshiftComboboxReturnValue, type TypeDownshiftMultiSelectProps, type TypeDownshiftMultiSelectReturnValue, type TypeDownshiftSelectProps, type TypeDownshiftSelectReturnValue, type TypeItemElements, 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 TypeMultiSelectMenuProps, type TypeNotEmptyChildren, type TypeSingleSelectMenuProps, type TypeUseItemsFromChildrenProps, defaultUseSelectProps, useItemsFromChildren, useMenu, useMenuContext, useSelectStateReducer };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as downshift from 'downshift';
|
|
3
|
-
import { GetItemPropsOptions, UseSelectProps, UseMultipleSelectionProps, UseSelectReturnValue, UseMultipleSelectionReturnValue } from 'downshift';
|
|
3
|
+
import { GetItemPropsOptions, UseComboboxProps, UseSelectProps, UseMultipleSelectionProps, UseComboboxReturnValue, UseSelectReturnValue, UseMultipleSelectionReturnValue } from 'downshift';
|
|
4
4
|
import { TypeBorderSystemProps, TypeColorSystemProps, TypeFlexboxSystemProps, TypeGridSystemProps, TypeLayoutSystemProps, TypePositionSystemProps, TypeSpaceSystemProps, TypeTypographySystemProps, TypeStyledComponentsCommonProps } from '@sproutsocial/seeds-react-system-props';
|
|
5
5
|
import * as styled_components from 'styled-components';
|
|
6
6
|
import * as React$1 from 'react';
|
|
@@ -22,14 +22,11 @@ declare const MENU_ITEM_ROLES: {
|
|
|
22
22
|
};
|
|
23
23
|
type TypeMenuItemRoles = (typeof MENU_ITEM_ROLES)[keyof typeof MENU_ITEM_ROLES];
|
|
24
24
|
|
|
25
|
-
interface
|
|
26
|
-
element: React.ReactElement<TypeMenuItemProps>;
|
|
27
|
-
parents: readonly React.ReactNode[];
|
|
28
|
-
}
|
|
29
|
-
interface TypeDefaultItemProps extends Partial<TypeItemElements> {
|
|
25
|
+
interface TypeDefaultItemProps {
|
|
30
26
|
id: string;
|
|
31
27
|
index: number;
|
|
32
28
|
disabled?: boolean;
|
|
29
|
+
menuItemProps?: TypeMenuItemProps;
|
|
33
30
|
}
|
|
34
31
|
type TypeNotEmptyChildren = React.ReactChild | React.ReactFragment | React.ReactPortal;
|
|
35
32
|
|
|
@@ -147,14 +144,34 @@ declare const StyledMenuGroup: styled_components.StyledComponent<"li", styled_co
|
|
|
147
144
|
declare const StyledTitle: styled_components.StyledComponent<React$1.FC<_sproutsocial_seeds_react_text.TypeTextProps>, styled_components.DefaultTheme, {}, never>;
|
|
148
145
|
declare const StyledMenuGroupUl: styled_components.StyledComponent<"ul", styled_components.DefaultTheme, {}, never>;
|
|
149
146
|
|
|
150
|
-
interface
|
|
147
|
+
interface TypeDownshiftComboboxProps extends Partial<UseComboboxProps<TypeDefaultItemProps>> {
|
|
148
|
+
}
|
|
149
|
+
interface TypeDownshiftSelectProps extends Partial<UseSelectProps<TypeDefaultItemProps>> {
|
|
150
|
+
}
|
|
151
|
+
interface TypeDownshiftMultiSelectProps extends Partial<Omit<UseMultipleSelectionProps<TypeDefaultItemProps>, "stateReducer" | "onStateChange" | "getA11yStatusMessage">> {
|
|
151
152
|
getA11yMultiStatusMessage?: UseMultipleSelectionProps<TypeDefaultItemProps>["getA11yStatusMessage"];
|
|
152
153
|
onMultiSelectStateChange?: UseMultipleSelectionProps<TypeDefaultItemProps>["onStateChange"];
|
|
153
154
|
multiSelectStateReducer?: UseMultipleSelectionProps<TypeDefaultItemProps>["stateReducer"];
|
|
154
155
|
}
|
|
155
|
-
interface
|
|
156
|
+
interface TypeDownshiftComboboxReturnValue extends Partial<UseComboboxReturnValue<TypeDefaultItemProps>> {
|
|
157
|
+
}
|
|
158
|
+
interface TypeDownshiftSelectReturnValue extends Partial<UseSelectReturnValue<TypeDefaultItemProps>> {
|
|
159
|
+
}
|
|
160
|
+
interface TypeDownshiftMultiSelectReturnValue extends Partial<UseMultipleSelectionReturnValue<TypeDefaultItemProps>> {
|
|
161
|
+
}
|
|
162
|
+
type TypeDonwshiftSharedReturnValue = "getLabelProps" | "getToggleButtonProps" | "getMenuProps";
|
|
163
|
+
type TypeDonwshiftSharedProps = "onHighlightedIndexChange" | "onIsOpenChange" | "onSelectedItemChange" | "onStateChange" | "stateReducer";
|
|
164
|
+
interface TypeMenuContextProps extends Omit<TypeDownshiftComboboxReturnValue, TypeDonwshiftSharedReturnValue>, Omit<TypeDownshiftComboboxProps, TypeDonwshiftSharedProps>, Omit<TypeDownshiftSelectReturnValue, TypeDonwshiftSharedReturnValue>, Omit<TypeDownshiftSelectProps, TypeDonwshiftSharedProps>, TypeDownshiftMultiSelectReturnValue, TypeDownshiftMultiSelectProps {
|
|
156
165
|
items: TypeDefaultItemProps[];
|
|
157
166
|
isListbox?: boolean;
|
|
167
|
+
onHighlightedIndexChange?: TypeDownshiftComboboxProps["onHighlightedIndexChange"] | TypeDownshiftSelectProps["onHighlightedIndexChange"];
|
|
168
|
+
onIsOpenChange?: TypeDownshiftComboboxProps["onIsOpenChange"] | TypeDownshiftSelectProps["onIsOpenChange"];
|
|
169
|
+
onSelectedItemChange?: TypeDownshiftComboboxProps["onSelectedItemChange"] | TypeDownshiftSelectProps["onSelectedItemChange"];
|
|
170
|
+
onStateChange?: TypeDownshiftComboboxProps["onStateChange"] | TypeDownshiftSelectProps["onStateChange"];
|
|
171
|
+
stateReducer?: TypeDownshiftComboboxProps["stateReducer"] | TypeDownshiftSelectProps["stateReducer"];
|
|
172
|
+
getLabelProps?: TypeDownshiftComboboxReturnValue["getLabelProps"] | TypeDownshiftSelectReturnValue["getLabelProps"];
|
|
173
|
+
getToggleButtonProps?: TypeDownshiftComboboxReturnValue["getToggleButtonProps"] | TypeDownshiftSelectReturnValue["getToggleButtonProps"];
|
|
174
|
+
getMenuProps?: TypeDownshiftComboboxReturnValue["getMenuProps"] | TypeDownshiftSelectReturnValue["getMenuProps"];
|
|
158
175
|
}
|
|
159
176
|
interface TypeMenuContext extends TypeMenuContextProps {
|
|
160
177
|
itemsMap: {
|
|
@@ -203,9 +220,10 @@ interface TypeMenuToggleButtonProps extends Partial<TypeButtonProps> {
|
|
|
203
220
|
declare const MenuToggleButton: ({ children, ...rest }: TypeMenuToggleButtonProps) => react_jsx_runtime.JSX.Element;
|
|
204
221
|
|
|
205
222
|
type TypeInvalidMenuProps = "initialSelectedItem" | "defaultSelectedItem" | "selectedItem";
|
|
206
|
-
interface TypeActionMenuProps extends TypeMenuRootOwnProps,
|
|
223
|
+
interface TypeActionMenuProps extends TypeMenuRootOwnProps, Omit<TypeDownshiftSelectProps, TypeInvalidMenuProps> {
|
|
207
224
|
children: TypeMenuRootProps["children"];
|
|
208
225
|
}
|
|
226
|
+
|
|
209
227
|
/**
|
|
210
228
|
* @link https://seeds.sproutsocial.com/components/action-menu/
|
|
211
229
|
*
|
|
@@ -217,7 +235,7 @@ interface TypeActionMenuProps extends TypeMenuRootOwnProps, Partial<Omit<UseSele
|
|
|
217
235
|
*/
|
|
218
236
|
declare const ActionMenu: ({ children, stateReducer: externalStateReducer, ...useSelectProps }: TypeActionMenuProps) => react_jsx_runtime.JSX.Element;
|
|
219
237
|
|
|
220
|
-
interface TypeSingleSelectMenuProps extends TypeMenuRootOwnProps,
|
|
238
|
+
interface TypeSingleSelectMenuProps extends TypeMenuRootOwnProps, TypeDownshiftSelectProps {
|
|
221
239
|
children: TypeMenuRootProps["children"];
|
|
222
240
|
}
|
|
223
241
|
|
|
@@ -231,7 +249,7 @@ interface TypeSingleSelectMenuProps extends TypeMenuRootOwnProps, Partial<UseSel
|
|
|
231
249
|
*/
|
|
232
250
|
declare const SingleSelectMenu: ({ children, stateReducer: externalStateReducer, ...useSelectProps }: TypeSingleSelectMenuProps) => react_jsx_runtime.JSX.Element;
|
|
233
251
|
|
|
234
|
-
interface TypeMultiSelectMenuProps extends TypeMenuRootOwnProps, TypeDownshiftMultiSelectProps {
|
|
252
|
+
interface TypeMultiSelectMenuProps extends TypeMenuRootOwnProps, TypeDownshiftSelectProps, TypeDownshiftMultiSelectProps {
|
|
235
253
|
children: TypeMenuRootProps["children"];
|
|
236
254
|
}
|
|
237
255
|
|
|
@@ -247,6 +265,10 @@ declare const MultiSelectMenu: ({ children, stateReducer: externalStateReducer,
|
|
|
247
265
|
interface TypeUseItemsFromChildrenProps {
|
|
248
266
|
children: ReactNode;
|
|
249
267
|
}
|
|
268
|
+
interface TypeItemElements {
|
|
269
|
+
element: React__default.ReactElement<TypeMenuItemProps>;
|
|
270
|
+
parents: readonly React__default.ReactNode[];
|
|
271
|
+
}
|
|
250
272
|
declare const useItemsFromChildren: ({ children, }: TypeUseItemsFromChildrenProps) => {
|
|
251
273
|
allMenuItems: TypeDefaultItemProps[];
|
|
252
274
|
menuItemsMap: {
|
|
@@ -260,4 +282,4 @@ declare const defaultUseSelectProps: {
|
|
|
260
282
|
isItemDisabled: (item: any) => boolean;
|
|
261
283
|
};
|
|
262
284
|
|
|
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 };
|
|
285
|
+
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 TypeDefaultItemProps, type TypeDownshiftComboboxProps, type TypeDownshiftComboboxReturnValue, type TypeDownshiftMultiSelectProps, type TypeDownshiftMultiSelectReturnValue, type TypeDownshiftSelectProps, type TypeDownshiftSelectReturnValue, type TypeItemElements, 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 TypeMultiSelectMenuProps, type TypeNotEmptyChildren, type TypeSingleSelectMenuProps, type TypeUseItemsFromChildrenProps, defaultUseSelectProps, useItemsFromChildren, useMenu, useMenuContext, useSelectStateReducer };
|
package/dist/index.js
CHANGED
|
@@ -1737,7 +1737,6 @@ var MenuItemContainer = import_styled_components2.default.li`
|
|
|
1737
1737
|
list-style-type: none;
|
|
1738
1738
|
margin-left: ${({ theme: theme2 }) => theme2.space[300]};
|
|
1739
1739
|
margin-right: ${({ theme: theme2 }) => theme2.space[300]};
|
|
1740
|
-
transition: all ${({ theme: theme2 }) => theme2.duration["fast"]};
|
|
1741
1740
|
|
|
1742
1741
|
&:first-child {
|
|
1743
1742
|
margin-top: ${({ theme: theme2 }) => theme2.space[300]};
|
|
@@ -1762,6 +1761,7 @@ var StyledMenuItem = import_styled_components2.default.div`
|
|
|
1762
1761
|
padding: ${({ theme: theme2 }) => theme2.space[300]};
|
|
1763
1762
|
outline: 0;
|
|
1764
1763
|
${({ theme: theme2 }) => theme2.typography[200]};
|
|
1764
|
+
transition: all ${({ theme: theme2 }) => theme2.duration["fast"]};
|
|
1765
1765
|
|
|
1766
1766
|
/* Highlighted */
|
|
1767
1767
|
${({ $highlighted }) => $highlighted && highlightedStyles}
|
|
@@ -1892,7 +1892,6 @@ var useOptionProps = ({
|
|
|
1892
1892
|
const { selectedItem, selectedItems, isListbox } = (0, import_react2.useContext)(MenuContext);
|
|
1893
1893
|
const selected = (0, import_react2.useMemo)(
|
|
1894
1894
|
() => selectedItem?.id === id || !!selectedItems?.find((item) => item?.id === id),
|
|
1895
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1896
1895
|
[selectedItem, selectedItems]
|
|
1897
1896
|
);
|
|
1898
1897
|
const label = inputLabelId || `menu-item-child-${id}`;
|
|
@@ -1922,12 +1921,9 @@ var MenuItem = ({
|
|
|
1922
1921
|
children,
|
|
1923
1922
|
onClick,
|
|
1924
1923
|
onKeyDown,
|
|
1925
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1926
1924
|
disabled: disabled2 = false,
|
|
1927
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1928
1925
|
ref,
|
|
1929
1926
|
href,
|
|
1930
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1931
1927
|
color: color2,
|
|
1932
1928
|
...props
|
|
1933
1929
|
}) => {
|
|
@@ -2070,7 +2066,7 @@ var MenuContent = ({
|
|
|
2070
2066
|
autoFocus: true,
|
|
2071
2067
|
id,
|
|
2072
2068
|
tabIndex: 0,
|
|
2073
|
-
onKeyDown: getToggleButtonProps?.()
|
|
2069
|
+
onKeyDown: getToggleButtonProps?.()["onKeyDown"] || void 0,
|
|
2074
2070
|
"aria-activedescendant": getToggleButtonProps?.()["aria-activedescendant"],
|
|
2075
2071
|
...getMenuProps?.(
|
|
2076
2072
|
{
|
|
@@ -2296,6 +2292,7 @@ var MenuRoot = ({
|
|
|
2296
2292
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MenuProvider, { ...contextProps, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2297
2293
|
import_seeds_react_popout.Popout,
|
|
2298
2294
|
{
|
|
2295
|
+
menuPopout: true,
|
|
2299
2296
|
isOpen: !!isOpen,
|
|
2300
2297
|
setIsOpen,
|
|
2301
2298
|
content: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CustomPopoutContent, { width: width2, children }),
|
|
@@ -2388,13 +2385,12 @@ var useItemsFromChildren = ({
|
|
|
2388
2385
|
const allMenuItemElements = getAllMenuItems(children);
|
|
2389
2386
|
const menuItemsMap2 = {};
|
|
2390
2387
|
const allMenuItems2 = allMenuItemElements.map(
|
|
2391
|
-
({ element
|
|
2388
|
+
({ element }, index) => {
|
|
2392
2389
|
const item = {
|
|
2393
2390
|
id: element.props.id,
|
|
2394
2391
|
disabled: element.props.disabled,
|
|
2395
2392
|
index,
|
|
2396
|
-
element
|
|
2397
|
-
parents
|
|
2393
|
+
menuItemProps: element.props
|
|
2398
2394
|
};
|
|
2399
2395
|
menuItemsMap2[`${item.id}`] = item;
|
|
2400
2396
|
return item;
|
|
@@ -2439,11 +2435,11 @@ var handleStateChange = (changes, currentSelectedItem) => {
|
|
|
2439
2435
|
const selectedItem = changes.selectedItem || currentSelectedItem;
|
|
2440
2436
|
if (!selectedItem)
|
|
2441
2437
|
return;
|
|
2442
|
-
if (selectedItem.
|
|
2438
|
+
if (selectedItem.disabled) {
|
|
2443
2439
|
return;
|
|
2444
2440
|
}
|
|
2445
2441
|
const isEnterKeyDown = changes.type === import_downshift2.useSelect.stateChangeTypes.ToggleButtonKeyDownEnter;
|
|
2446
|
-
const selectedItemProps = selectedItem.
|
|
2442
|
+
const selectedItemProps = selectedItem.menuItemProps;
|
|
2447
2443
|
if (selectedItemProps?.onClick) {
|
|
2448
2444
|
const syntheticKeyboardEvent = new KeyboardEvent("keydown", {
|
|
2449
2445
|
key: isEnterKeyDown ? "Enter" : " ",
|