@pushwoosh/dumb-components 2.7.1 → 2.7.2
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/DropdownMenu/components/DropdownMenu/DropdownMenu.d.ts +5 -3
- package/DropdownMenu/components/DropdownMenu/DropdownMenu.js +5 -3
- package/DropdownMenu/components/DropdownMenuButton/DropdownMenuButton.d.ts +3 -1
- package/DropdownMenu/components/DropdownMenuButton/DropdownMenuButton.js +3 -1
- package/DropdownMenu/components/DropdownMenuItem/DropdownMenuItem.d.ts +1 -1
- package/DropdownMenu/components/DropdownMenuItem/DropdownMenuItem.js +1 -1
- package/DropdownMenu/components/DropdownMenuSection/DropdownMenuSection.d.ts +2 -1
- package/DropdownMenu/components/DropdownMenuSection/DropdownMenuSection.js +2 -1
- package/DropdownMenu/components/DropdownMenuSection/types.d.ts +1 -1
- package/DropdownMenu/components/DropdownMenuSubmenu/DropdownMenuSubmenu.d.ts +6 -4
- package/DropdownMenu/components/DropdownMenuSubmenu/DropdownMenuSubmenu.js +6 -4
- package/package.json +1 -1
|
@@ -2,14 +2,16 @@ import { type FC } from 'react';
|
|
|
2
2
|
import { type DropdownMenuProps } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* Floating dropdown menu anchored to a custom trigger (`renderHandler`), with
|
|
5
|
-
* auto-placement, click-outside close and layered z-index.
|
|
6
|
-
* {@link DropdownMenuItem}
|
|
5
|
+
* auto-placement, click-outside close and layered z-index. Children are {@link DropdownMenuSection}s
|
|
6
|
+
* holding {@link DropdownMenuItem}s and {@link DropdownMenuSubmenu}s — the surface itself has no padding.
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
9
|
* <DropdownMenu renderHandler={({ ref, onClick, isOpen }) => (
|
|
10
10
|
* <Button boxRef={ref} onClick={onClick} isOpen={isOpen} color="secondary">Menu</Button>
|
|
11
11
|
* )}>
|
|
12
|
-
* <
|
|
12
|
+
* <DropdownMenuSection>
|
|
13
|
+
* <DropdownMenuItem onClick={edit}>Edit</DropdownMenuItem>
|
|
14
|
+
* </DropdownMenuSection>
|
|
13
15
|
* </DropdownMenu>
|
|
14
16
|
*/
|
|
15
17
|
export declare const DropdownMenu: FC<DropdownMenuProps>;
|
|
@@ -10,14 +10,16 @@ import { useSubmenuRegistry } from '../../shared/useSubmenuRegistry';
|
|
|
10
10
|
const defaultPlacements = ['top-start', 'top-end', 'bottom-start', 'bottom-end'];
|
|
11
11
|
/**
|
|
12
12
|
* Floating dropdown menu anchored to a custom trigger (`renderHandler`), with
|
|
13
|
-
* auto-placement, click-outside close and layered z-index.
|
|
14
|
-
* {@link DropdownMenuItem}
|
|
13
|
+
* auto-placement, click-outside close and layered z-index. Children are {@link DropdownMenuSection}s
|
|
14
|
+
* holding {@link DropdownMenuItem}s and {@link DropdownMenuSubmenu}s — the surface itself has no padding.
|
|
15
15
|
*
|
|
16
16
|
* @example
|
|
17
17
|
* <DropdownMenu renderHandler={({ ref, onClick, isOpen }) => (
|
|
18
18
|
* <Button boxRef={ref} onClick={onClick} isOpen={isOpen} color="secondary">Menu</Button>
|
|
19
19
|
* )}>
|
|
20
|
-
* <
|
|
20
|
+
* <DropdownMenuSection>
|
|
21
|
+
* <DropdownMenuItem onClick={edit}>Edit</DropdownMenuItem>
|
|
22
|
+
* </DropdownMenuSection>
|
|
21
23
|
* </DropdownMenu>
|
|
22
24
|
*/
|
|
23
25
|
export const DropdownMenu = ({
|
|
@@ -5,7 +5,9 @@ import { type DropdownMenuButtonProps } from './types';
|
|
|
5
5
|
*
|
|
6
6
|
* @example
|
|
7
7
|
* <DropdownMenuButton label="Actions" color="secondary">
|
|
8
|
-
* <
|
|
8
|
+
* <DropdownMenuSection>
|
|
9
|
+
* <DropdownMenuItem onClick={remove} isDanger>Delete</DropdownMenuItem>
|
|
10
|
+
* </DropdownMenuSection>
|
|
9
11
|
* </DropdownMenuButton>
|
|
10
12
|
*/
|
|
11
13
|
export declare const DropdownMenuButton: FC<DropdownMenuButtonProps>;
|
|
@@ -6,7 +6,9 @@ import { DropdownMenu } from '../DropdownMenu';
|
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
8
|
* <DropdownMenuButton label="Actions" color="secondary">
|
|
9
|
-
* <
|
|
9
|
+
* <DropdownMenuSection>
|
|
10
|
+
* <DropdownMenuItem onClick={remove} isDanger>Delete</DropdownMenuItem>
|
|
11
|
+
* </DropdownMenuSection>
|
|
10
12
|
* </DropdownMenuButton>
|
|
11
13
|
*/
|
|
12
14
|
export const DropdownMenuButton = ({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Clickable row inside a {@link DropdownMenu}, with active (checked), danger and
|
|
3
3
|
* disabled states. A disabled item with `hint` stays focusable and explains itself in a tooltip.
|
|
4
|
-
* Must be rendered inside a {@link DropdownMenu}.
|
|
4
|
+
* Must be rendered inside a {@link DropdownMenuSection} of a {@link DropdownMenu}.
|
|
5
5
|
*
|
|
6
6
|
* @example
|
|
7
7
|
* <DropdownMenuItem onClick={select} isActive={selected}>Option</DropdownMenuItem>
|
|
@@ -7,7 +7,7 @@ import { DropdownContext } from '../../context';
|
|
|
7
7
|
/**
|
|
8
8
|
* Clickable row inside a {@link DropdownMenu}, with active (checked), danger and
|
|
9
9
|
* disabled states. A disabled item with `hint` stays focusable and explains itself in a tooltip.
|
|
10
|
-
* Must be rendered inside a {@link DropdownMenu}.
|
|
10
|
+
* Must be rendered inside a {@link DropdownMenuSection} of a {@link DropdownMenu}.
|
|
11
11
|
*
|
|
12
12
|
* @example
|
|
13
13
|
* <DropdownMenuItem onClick={select} isActive={selected}>Option</DropdownMenuItem>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type FC } from 'react';
|
|
2
2
|
import { type DropdownMenuSectionProps } from './types';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Required wrapper for {@link DropdownMenuItem}s inside a {@link DropdownMenu}: gives the rows their
|
|
5
|
+
* 8px vertical padding and a divider between sections. `title` is optional, the section is not.
|
|
5
6
|
*
|
|
6
7
|
* @example
|
|
7
8
|
* <DropdownMenuSection title="Account">
|
|
@@ -4,7 +4,8 @@ import { Horizontal } from '@pushwoosh/kit-helpers';
|
|
|
4
4
|
import { Text } from '@pushwoosh/kit-typography';
|
|
5
5
|
import { DropdownMenuSectionRoot } from './styles';
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Required wrapper for {@link DropdownMenuItem}s inside a {@link DropdownMenu}: gives the rows their
|
|
8
|
+
* 8px vertical padding and a divider between sections. `title` is optional, the section is not.
|
|
8
9
|
*
|
|
9
10
|
* @example
|
|
10
11
|
* <DropdownMenuSection title="Account">
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type PropsWithChildren } from 'react';
|
|
2
2
|
/** Props of {@link DropdownMenuSection}. */
|
|
3
3
|
export type DropdownMenuSectionProps = PropsWithChildren<{
|
|
4
|
-
/** Optional uppercase section heading. */
|
|
4
|
+
/** Optional uppercase section heading; the section itself is required around menu rows. */
|
|
5
5
|
title?: string;
|
|
6
6
|
/** Background color of the section. */
|
|
7
7
|
bgColor?: string;
|
|
@@ -2,11 +2,13 @@ import { type FC } from 'react';
|
|
|
2
2
|
import { type DropdownMenuSubmenuProps } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* Nested submenu inside a {@link DropdownMenu}: a trigger row that opens a flyout
|
|
5
|
-
* of further items on hover or click. Must be rendered inside a {@link
|
|
5
|
+
* of further items on hover or click. Must be rendered inside a {@link DropdownMenuSection}.
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
|
-
* <
|
|
9
|
-
* <
|
|
10
|
-
* </
|
|
8
|
+
* <DropdownMenuSection>
|
|
9
|
+
* <DropdownMenuSubmenu label="More">
|
|
10
|
+
* <DropdownMenuItem onClick={archive}>Archive</DropdownMenuItem>
|
|
11
|
+
* </DropdownMenuSubmenu>
|
|
12
|
+
* </DropdownMenuSection>
|
|
11
13
|
*/
|
|
12
14
|
export declare const DropdownMenuSubmenu: FC<DropdownMenuSubmenuProps>;
|
|
@@ -12,12 +12,14 @@ const OPEN_DELAY = 100;
|
|
|
12
12
|
const CLOSE_DELAY = 200;
|
|
13
13
|
/**
|
|
14
14
|
* Nested submenu inside a {@link DropdownMenu}: a trigger row that opens a flyout
|
|
15
|
-
* of further items on hover or click. Must be rendered inside a {@link
|
|
15
|
+
* of further items on hover or click. Must be rendered inside a {@link DropdownMenuSection}.
|
|
16
16
|
*
|
|
17
17
|
* @example
|
|
18
|
-
* <
|
|
19
|
-
* <
|
|
20
|
-
* </
|
|
18
|
+
* <DropdownMenuSection>
|
|
19
|
+
* <DropdownMenuSubmenu label="More">
|
|
20
|
+
* <DropdownMenuItem onClick={archive}>Archive</DropdownMenuItem>
|
|
21
|
+
* </DropdownMenuSubmenu>
|
|
22
|
+
* </DropdownMenuSection>
|
|
21
23
|
*/
|
|
22
24
|
export const DropdownMenuSubmenu = ({
|
|
23
25
|
label,
|