@sproutsocial/seeds-react-menu 1.10.6 → 1.10.8
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 +12 -12
- package/CHANGELOG.md +18 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
- package/src/MenuSearchInput/MenuSearchInput.tsx +2 -0
- package/src/MenuSearchInput/__tests__/MenuSearchInput.test.tsx +23 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sproutsocial/seeds-react-menu",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.8",
|
|
4
4
|
"description": "Seeds React Menu",
|
|
5
5
|
"author": "Sprout Social, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,17 +32,17 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@radix-ui/react-popover": "^1.1.2",
|
|
34
34
|
"@sproutsocial/seeds-react-box": "^1.1.16",
|
|
35
|
-
"@sproutsocial/seeds-react-button": "^2.0.
|
|
36
|
-
"@sproutsocial/seeds-react-checkbox": "^1.3.
|
|
37
|
-
"@sproutsocial/seeds-react-icon": "^2.3.
|
|
38
|
-
"@sproutsocial/seeds-react-input": "^1.5.
|
|
35
|
+
"@sproutsocial/seeds-react-button": "^2.0.1",
|
|
36
|
+
"@sproutsocial/seeds-react-checkbox": "^1.3.29",
|
|
37
|
+
"@sproutsocial/seeds-react-icon": "^2.3.3",
|
|
38
|
+
"@sproutsocial/seeds-react-input": "^1.5.12",
|
|
39
39
|
"@sproutsocial/seeds-react-label": "^1.0.16",
|
|
40
|
-
"@sproutsocial/seeds-react-popout": "^2.4.
|
|
40
|
+
"@sproutsocial/seeds-react-popout": "^2.4.33",
|
|
41
41
|
"@sproutsocial/seeds-react-radio": "^1.3.16",
|
|
42
|
-
"@sproutsocial/seeds-react-switch": "^1.2.
|
|
42
|
+
"@sproutsocial/seeds-react-switch": "^1.2.28",
|
|
43
43
|
"@sproutsocial/seeds-react-system-props": "^3.0.2",
|
|
44
44
|
"@sproutsocial/seeds-react-theme": "^3.6.2",
|
|
45
|
-
"@sproutsocial/seeds-react-token-input": "^1.4.
|
|
45
|
+
"@sproutsocial/seeds-react-token-input": "^1.4.34",
|
|
46
46
|
"@sproutsocial/seeds-react-utilities": "^4.3.0",
|
|
47
47
|
"@tanstack/react-virtual": "^3.13.12",
|
|
48
48
|
"downshift": "9.0.4",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"styled-system": "^5.1.5"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@sproutsocial/seeds-react-tooltip": "^1.1.
|
|
54
|
+
"@sproutsocial/seeds-react-tooltip": "^1.1.15",
|
|
55
55
|
"@sproutsocial/eslint-config-seeds": "*",
|
|
56
56
|
"@sproutsocial/seeds-react-testing-library": "*",
|
|
57
57
|
"@sproutsocial/seeds-testing": "*",
|
|
@@ -25,6 +25,7 @@ export interface TypeMenuSearchInputProps extends TypeInputProps {
|
|
|
25
25
|
export const MenuSearchInput = ({
|
|
26
26
|
getIsItemVisible,
|
|
27
27
|
inputProps,
|
|
28
|
+
onChange,
|
|
28
29
|
...restInputProps
|
|
29
30
|
}: TypeMenuSearchInputProps) => {
|
|
30
31
|
const {
|
|
@@ -63,6 +64,7 @@ export const MenuSearchInput = ({
|
|
|
63
64
|
<Input
|
|
64
65
|
onChange={(e, value) => {
|
|
65
66
|
updateFilteredItems({ inputValue: value });
|
|
67
|
+
onChange?.(e, value);
|
|
66
68
|
}}
|
|
67
69
|
// apply onKeyDown logic for downshift keyboard accessibility support
|
|
68
70
|
onKeyDown={handleKeyDown}
|
|
@@ -153,5 +153,28 @@ describe("MenuSearchInput", () => {
|
|
|
153
153
|
|
|
154
154
|
expect(customFilter).toHaveBeenCalled();
|
|
155
155
|
});
|
|
156
|
+
|
|
157
|
+
it("should call the passed onChange prop and still filter items", async () => {
|
|
158
|
+
const handleChange = jest.fn();
|
|
159
|
+
const { user } = render(
|
|
160
|
+
<Component {...defaultProps({ onChange: handleChange })} />
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
await user.click(screen.getByRole("button", { name: "Open Menu" }));
|
|
164
|
+
|
|
165
|
+
const inputElement = screen.getByRole("searchbox") as HTMLInputElement;
|
|
166
|
+
await act(async () => {
|
|
167
|
+
await user.click(inputElement);
|
|
168
|
+
await user.type(inputElement, "Item 0");
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
// onChange prop was forwarded
|
|
172
|
+
await waitFor(() => expect(handleChange).toHaveBeenCalled());
|
|
173
|
+
|
|
174
|
+
// updateFilteredItems still ran — only the matching item is visible
|
|
175
|
+
await waitFor(() =>
|
|
176
|
+
expect(screen.queryAllByRole(menuItemRole).length).toBe(1)
|
|
177
|
+
);
|
|
178
|
+
});
|
|
156
179
|
});
|
|
157
180
|
});
|