@apify/ui-library 1.103.2-featurereact19upgrade-8b5553.91 → 1.103.2-featurereact19upgrade-8b5553.123
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/dist/src/components/floating/menu.d.ts +3 -1
- package/dist/src/components/floating/menu.d.ts.map +1 -1
- package/dist/src/components/floating/menu.js +2 -1
- package/dist/src/components/floating/menu.js.map +1 -1
- package/dist/src/components/floating/menu_common.d.ts +5 -3
- package/dist/src/components/floating/menu_common.d.ts.map +1 -1
- package/dist/src/components/floating/menu_common.js +2 -2
- package/dist/src/components/floating/menu_common.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/components/floating/menu.tsx +4 -0
- package/src/components/floating/menu_common.tsx +7 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apify/ui-library",
|
|
3
|
-
"version": "1.103.2-featurereact19upgrade-8b5553.
|
|
3
|
+
"version": "1.103.2-featurereact19upgrade-8b5553.123+e6b6f72f6ef",
|
|
4
4
|
"description": "React UI library used by apify.com",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"It's not nice, but helps us to get around the problem of multiple react instances."
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@apify/ui-icons": "^1.21.1-featurereact19upgrade-8b5553.
|
|
29
|
+
"@apify/ui-icons": "^1.21.1-featurereact19upgrade-8b5553.123+e6b6f72f6ef",
|
|
30
30
|
"@floating-ui/react": "^0.26.2",
|
|
31
31
|
"@react-hook/resize-observer": "^2.0.2",
|
|
32
32
|
"clsx": "^2.0.0",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"src",
|
|
65
65
|
"style"
|
|
66
66
|
],
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "e6b6f72f6ef52a2b2af4463a5a3ea9c0c21e65be"
|
|
68
68
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FloatingFocusManager,
|
|
3
3
|
FloatingPortal,
|
|
4
|
+
type Placement,
|
|
4
5
|
useClick,
|
|
5
6
|
useDismiss,
|
|
6
7
|
useInteractions,
|
|
@@ -54,6 +55,7 @@ export interface MenuProps<T = MenuOption> {
|
|
|
54
55
|
defaultLabel?: React.ReactNode,
|
|
55
56
|
closeOnSelect?: boolean,
|
|
56
57
|
renderOption?: (option: T) => React.ReactNode,
|
|
58
|
+
placement?: Placement,
|
|
57
59
|
components?: {
|
|
58
60
|
MenuBase?: React.ElementType,
|
|
59
61
|
Menu?: React.ElementType,
|
|
@@ -78,6 +80,7 @@ export const Menu = <T extends MenuOption>({
|
|
|
78
80
|
components,
|
|
79
81
|
renderOption,
|
|
80
82
|
className,
|
|
83
|
+
placement,
|
|
81
84
|
...rest
|
|
82
85
|
}: MenuProps<T> & BoxProps) => {
|
|
83
86
|
const [isOpen, setIsOpenState] = useState(false);
|
|
@@ -90,6 +93,7 @@ export const Menu = <T extends MenuOption>({
|
|
|
90
93
|
const { refs, floatingStyles, context } = useFloatingMenu({
|
|
91
94
|
isOpen,
|
|
92
95
|
setIsOpen,
|
|
96
|
+
placement,
|
|
93
97
|
});
|
|
94
98
|
|
|
95
99
|
const selectedIndex = useMemo(() => {
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
Placement,
|
|
3
|
+
} from '@floating-ui/react';
|
|
1
4
|
import {
|
|
2
5
|
autoUpdate,
|
|
3
6
|
offset,
|
|
@@ -8,11 +11,13 @@ import {
|
|
|
8
11
|
export const useFloatingMenu = ({
|
|
9
12
|
isOpen,
|
|
10
13
|
setIsOpen,
|
|
14
|
+
placement = 'bottom-start',
|
|
11
15
|
}: {
|
|
12
16
|
isOpen: boolean,
|
|
13
|
-
setIsOpen: (newIsOpen: boolean) => void
|
|
17
|
+
setIsOpen: (newIsOpen: boolean) => void,
|
|
18
|
+
placement?: Placement,
|
|
14
19
|
}) => useFloating<Element>({
|
|
15
|
-
placement
|
|
20
|
+
placement,
|
|
16
21
|
open: isOpen,
|
|
17
22
|
onOpenChange: setIsOpen,
|
|
18
23
|
whileElementsMounted: autoUpdate,
|