@atlaskit/dropdown-menu 11.4.0 → 11.5.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/dropdown-menu
2
2
 
3
+ ## 11.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`7f7e4a0709b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7f7e4a0709b) - Fixes the types of the CustomTrigger to be generic rather than set as HTMLElement. This allows improved type inference for custom triggers.
8
+
3
9
  ## 11.4.0
4
10
 
5
11
  ### Minor Changes
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/dropdown-menu",
3
- "version": "11.4.0",
3
+ "version": "11.5.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/dropdown-menu",
3
- "version": "11.4.0",
3
+ "version": "11.5.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/dropdown-menu",
3
- "version": "11.4.0",
3
+ "version": "11.5.0",
4
4
  "sideEffects": false
5
5
  }
@@ -9,5 +9,5 @@ import type { DropdownMenuProps } from './types';
9
9
  * - [Code](https://atlassian.design/components/dropdown-menu/code)
10
10
  * - [Usage](https://atlassian.design/components/dropdown-menu/usage)
11
11
  */
12
- declare const DropdownMenu: (props: DropdownMenuProps) => jsx.JSX.Element;
12
+ declare const DropdownMenu: <T extends HTMLElement = HTMLElement>(props: DropdownMenuProps<T>) => jsx.JSX.Element;
13
13
  export default DropdownMenu;
@@ -15,11 +15,11 @@ export declare type FocusItem = {
15
15
  itemNode: HTMLElement;
16
16
  };
17
17
  export declare type Behaviors = 'checkbox' | 'radio' | 'menuitemcheckbox' | 'menuitemradio';
18
- export interface CustomTriggerProps extends Omit<TriggerProps, 'ref'> {
18
+ export interface CustomTriggerProps<TriggerElement extends HTMLElement = HTMLElement> extends Omit<TriggerProps, 'ref'> {
19
19
  /**
20
20
  * Ref that should be applied to the trigger. This is used to calculate the menu position.
21
21
  */
22
- triggerRef: Ref<HTMLElement>;
22
+ triggerRef: Ref<TriggerElement>;
23
23
  /**
24
24
  * Makes the trigger appear selected.
25
25
  */
@@ -49,7 +49,7 @@ export interface MenuWrapperProps extends MenuGroupProps {
49
49
  }
50
50
  export interface DropdownMenuGroupProps extends SectionProps {
51
51
  }
52
- export interface DropdownMenuProps {
52
+ export interface DropdownMenuProps<TriggerElement extends HTMLElement = HTMLElement> {
53
53
  /**
54
54
  * Controls the appearance of the menu.
55
55
  * Default menu has scroll after its height exceeds the pre-defined amount.
@@ -93,7 +93,7 @@ export interface DropdownMenuProps {
93
93
  * Content which will trigger the dropdown menu to open and close. Use with `triggerType`
94
94
  * to easily get a button trigger.
95
95
  */
96
- trigger?: string | ((triggerButtonProps: CustomTriggerProps) => ReactElement);
96
+ trigger?: string | ((triggerButtonProps: CustomTriggerProps<TriggerElement>) => ReactElement);
97
97
  /**
98
98
  * A `testId` prop is provided for specified elements, which is a unique
99
99
  * string that appears as a data attribute `data-testid` in the rendered code,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/dropdown-menu",
3
- "version": "11.4.0",
3
+ "version": "11.5.0",
4
4
  "description": "A dropdown menu displays a list of actions or options to a user.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"