@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.
@@ -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. Fill it with
6
- * {@link DropdownMenuItem}, {@link DropdownMenuSection} and {@link DropdownMenuSubmenu}.
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
- * <DropdownMenuItem onClick={edit}>Edit</DropdownMenuItem>
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. Fill it with
14
- * {@link DropdownMenuItem}, {@link DropdownMenuSection} and {@link DropdownMenuSubmenu}.
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
- * <DropdownMenuItem onClick={edit}>Edit</DropdownMenuItem>
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
- * <DropdownMenuItem onClick={remove} isDanger>Delete</DropdownMenuItem>
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
- * <DropdownMenuItem onClick={remove} isDanger>Delete</DropdownMenuItem>
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
- * Groups {@link DropdownMenuItem}s under an optional heading inside a {@link DropdownMenu}.
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
- * Groups {@link DropdownMenuItem}s under an optional heading inside a {@link DropdownMenu}.
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 DropdownMenu}.
5
+ * of further items on hover or click. Must be rendered inside a {@link DropdownMenuSection}.
6
6
  *
7
7
  * @example
8
- * <DropdownMenuSubmenu label="More">
9
- * <DropdownMenuItem onClick={archive}>Archive</DropdownMenuItem>
10
- * </DropdownMenuSubmenu>
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 DropdownMenu}.
15
+ * of further items on hover or click. Must be rendered inside a {@link DropdownMenuSection}.
16
16
  *
17
17
  * @example
18
- * <DropdownMenuSubmenu label="More">
19
- * <DropdownMenuItem onClick={archive}>Archive</DropdownMenuItem>
20
- * </DropdownMenuSubmenu>
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/dumb-components",
3
- "version": "2.7.1",
3
+ "version": "2.7.2",
4
4
  "description": "React components to build Pushwoosh products",
5
5
  "main": "index.js",
6
6
  "module": "index.js",