@atlaskit/dropdown-menu 11.10.6 → 11.11.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,21 @@
1
1
  # @atlaskit/dropdown-menu
2
2
 
3
+ ## 11.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`3920dcfd848`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3920dcfd848) - This removes the feature flag made for upgrading the `focus-trap` dependency and keeps `focus-trap` at it's original version.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+
13
+ ## 11.10.7
14
+
15
+ ### Patch Changes
16
+
17
+ - [`4b99836860e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4b99836860e) - Using arrow keys to move between items will no longer cause scrolling when at the top/bottom of the list.
18
+
3
19
  ## 11.10.6
4
20
 
5
21
  ### Patch Changes
@@ -50,15 +50,17 @@ function handleFocus(refs) {
50
50
  var action = actionMap[e.key];
51
51
  switch (action) {
52
52
  case 'next':
53
+ // Always cancelling the event to prevent scrolling
54
+ e.preventDefault();
53
55
  if (currentFocusedIdx < refs.length - 1) {
54
- e.preventDefault();
55
56
  var _nextFocusableElement = getNextFocusableElement(refs, currentFocusedIdx);
56
57
  _nextFocusableElement && _nextFocusableElement.focus();
57
58
  }
58
59
  break;
59
60
  case 'prev':
61
+ // Always cancelling the event to prevent scrolling
62
+ e.preventDefault();
60
63
  if (currentFocusedIdx > 0) {
61
- e.preventDefault();
62
64
  var _prevFocusableElement = getPrevFocusableElement(refs, currentFocusedIdx);
63
65
  _prevFocusableElement && _prevFocusableElement.focus();
64
66
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/dropdown-menu",
3
- "version": "11.10.6",
3
+ "version": "11.11.0",
4
4
  "sideEffects": false
5
5
  }
@@ -46,15 +46,17 @@ export default function handleFocus(refs) {
46
46
  const action = actionMap[e.key];
47
47
  switch (action) {
48
48
  case 'next':
49
+ // Always cancelling the event to prevent scrolling
50
+ e.preventDefault();
49
51
  if (currentFocusedIdx < refs.length - 1) {
50
- e.preventDefault();
51
52
  const nextFocusableElement = getNextFocusableElement(refs, currentFocusedIdx);
52
53
  nextFocusableElement && nextFocusableElement.focus();
53
54
  }
54
55
  break;
55
56
  case 'prev':
57
+ // Always cancelling the event to prevent scrolling
58
+ e.preventDefault();
56
59
  if (currentFocusedIdx > 0) {
57
- e.preventDefault();
58
60
  const prevFocusableElement = getPrevFocusableElement(refs, currentFocusedIdx);
59
61
  prevFocusableElement && prevFocusableElement.focus();
60
62
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/dropdown-menu",
3
- "version": "11.10.6",
3
+ "version": "11.11.0",
4
4
  "sideEffects": false
5
5
  }
@@ -43,15 +43,17 @@ export default function handleFocus(refs) {
43
43
  var action = actionMap[e.key];
44
44
  switch (action) {
45
45
  case 'next':
46
+ // Always cancelling the event to prevent scrolling
47
+ e.preventDefault();
46
48
  if (currentFocusedIdx < refs.length - 1) {
47
- e.preventDefault();
48
49
  var _nextFocusableElement = getNextFocusableElement(refs, currentFocusedIdx);
49
50
  _nextFocusableElement && _nextFocusableElement.focus();
50
51
  }
51
52
  break;
52
53
  case 'prev':
54
+ // Always cancelling the event to prevent scrolling
55
+ e.preventDefault();
53
56
  if (currentFocusedIdx > 0) {
54
- e.preventDefault();
55
57
  var _prevFocusableElement = getPrevFocusableElement(refs, currentFocusedIdx);
56
58
  _prevFocusableElement && _prevFocusableElement.focus();
57
59
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/dropdown-menu",
3
- "version": "11.10.6",
3
+ "version": "11.11.0",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/dropdown-menu",
3
- "version": "11.10.6",
3
+ "version": "11.11.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/"
@@ -37,11 +37,11 @@
37
37
  "@atlaskit/icon": "^21.12.0",
38
38
  "@atlaskit/menu": "^1.9.0",
39
39
  "@atlaskit/platform-feature-flags": "^0.2.2",
40
- "@atlaskit/popup": "^1.8.0",
40
+ "@atlaskit/popup": "^1.9.0",
41
41
  "@atlaskit/primitives": "^1.0.0",
42
42
  "@atlaskit/spinner": "^15.5.0",
43
43
  "@atlaskit/theme": "^12.5.0",
44
- "@atlaskit/tokens": "^1.12.0",
44
+ "@atlaskit/tokens": "^1.13.0",
45
45
  "@atlaskit/visually-hidden": "^1.2.0",
46
46
  "@babel/runtime": "^7.0.0",
47
47
  "@emotion/react": "^11.7.1",
@@ -0,0 +1,146 @@
1
+ ## API Report File for "@atlaskit/dropdown-menu"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ /// <reference types="react" />
8
+
9
+ import type { CustomItemProps } from '@atlaskit/menu/types';
10
+ import { default as DropdownItemGroup } from '@atlaskit/menu/section';
11
+ import { KeyboardEvent as KeyboardEvent_2 } from 'react';
12
+ import type { MenuGroupProps } from '@atlaskit/menu/types';
13
+ import { MouseEvent as MouseEvent_2 } from 'react';
14
+ import { default as React_2 } from 'react';
15
+ import { ReactElement } from 'react';
16
+ import { ReactNode } from 'react';
17
+ import { Ref } from 'react';
18
+ import type { SectionProps } from '@atlaskit/menu';
19
+ import type { SectionProps as SectionProps_2 } from '@atlaskit/menu/types';
20
+ import type { TriggerProps } from '@atlaskit/popup/types';
21
+
22
+ // @public (undocumented)
23
+ export interface CustomTriggerProps<TriggerElement extends HTMLElement = HTMLElement> extends Omit<TriggerProps, 'ref'> {
24
+ isSelected?: boolean;
25
+ onClick?: (e: KeyboardEvent_2 | MouseEvent_2) => void;
26
+ testId?: string;
27
+ triggerRef: Ref<TriggerElement>;
28
+ }
29
+
30
+ // @public
31
+ export const DropdownItem: React_2.ForwardRefExoticComponent<DropdownItemProps & React_2.RefAttributes<HTMLElement>>;
32
+
33
+ // @public
34
+ export const DropdownItemCheckbox: (props: DropdownItemCheckboxProps) => JSX.Element;
35
+
36
+ // @public
37
+ export const DropdownItemCheckboxGroup: (props: DropdownItemCheckboxGroupProps) => JSX.Element;
38
+
39
+ // @public (undocumented)
40
+ interface DropdownItemCheckboxGroupProps extends SectionProps {
41
+ id: string;
42
+ }
43
+
44
+ // @public (undocumented)
45
+ interface DropdownItemCheckboxProps {
46
+ children: React.ReactNode;
47
+ defaultSelected?: boolean;
48
+ description?: JSX.Element | string;
49
+ id: string;
50
+ isDisabled?: boolean;
51
+ isSelected?: boolean;
52
+ onClick?: (e: KeyboardEvent_2 | MouseEvent_2) => void;
53
+ shouldDescriptionWrap?: boolean;
54
+ shouldTitleWrap?: boolean;
55
+ testId?: string;
56
+ title?: string;
57
+ }
58
+
59
+ export { DropdownItemGroup }
60
+
61
+ // @public (undocumented)
62
+ export interface DropdownItemProps {
63
+ children: React.ReactNode;
64
+ component?: CustomItemProps['component'];
65
+ description?: JSX.Element | string;
66
+ elemAfter?: React.ReactNode;
67
+ elemBefore?: React.ReactNode;
68
+ href?: string;
69
+ isDisabled?: boolean;
70
+ isSelected?: boolean;
71
+ onClick?: (e: KeyboardEvent_2 | MouseEvent_2) => void;
72
+ rel?: string;
73
+ shouldDescriptionWrap?: boolean;
74
+ shouldTitleWrap?: boolean;
75
+ target?: string;
76
+ testId?: string;
77
+ title?: string;
78
+ }
79
+
80
+ // @public
81
+ export const DropdownItemRadio: (props: DropdownItemRadioProps) => JSX.Element;
82
+
83
+ // @public
84
+ export const DropdownItemRadioGroup: (props: DropdownItemRadioGroupProps) => JSX.Element;
85
+
86
+ // @public (undocumented)
87
+ interface DropdownItemRadioGroupProps extends SectionProps {
88
+ // (undocumented)
89
+ id: string;
90
+ }
91
+
92
+ // @public (undocumented)
93
+ interface DropdownItemRadioProps {
94
+ children: React.ReactNode;
95
+ defaultSelected?: boolean;
96
+ description?: JSX.Element | string;
97
+ id: string;
98
+ isDisabled?: boolean;
99
+ isSelected?: boolean;
100
+ onClick?: (e: KeyboardEvent_2 | MouseEvent_2) => void;
101
+ shouldDescriptionWrap?: boolean;
102
+ shouldTitleWrap?: boolean;
103
+ testId?: string;
104
+ title?: string;
105
+ }
106
+
107
+ // @public
108
+ const DropdownMenu: <T extends HTMLElement = HTMLElement>(props: DropdownMenuProps<T>) => JSX.Element;
109
+ export default DropdownMenu;
110
+
111
+ // @public (undocumented)
112
+ export interface DropdownMenuGroupProps extends SectionProps_2 {
113
+ }
114
+
115
+ // @public (undocumented)
116
+ export interface DropdownMenuProps<TriggerElement extends HTMLElement = HTMLElement> {
117
+ appearance?: 'default' | 'tall';
118
+ autoFocus?: boolean;
119
+ children?: ReactNode;
120
+ defaultOpen?: boolean;
121
+ isLoading?: boolean;
122
+ isOpen?: boolean;
123
+ onOpenChange?: (args: OnOpenChangeArgs) => void;
124
+ placement?: Placement;
125
+ shouldFlip?: boolean;
126
+ spacing?: Extract<MenuGroupProps['spacing'], 'compact' | 'cozy'>;
127
+ statusLabel?: string;
128
+ testId?: string;
129
+ trigger?: ((triggerButtonProps: CustomTriggerProps<TriggerElement>) => ReactElement) | string;
130
+ zIndex?: number;
131
+ }
132
+
133
+ // @public (undocumented)
134
+ export interface OnOpenChangeArgs {
135
+ // (undocumented)
136
+ event: KeyboardEvent_2 | MouseEvent_2;
137
+ // (undocumented)
138
+ isOpen: boolean;
139
+ }
140
+
141
+ // @public (undocumented)
142
+ type Placement = 'auto' | 'auto-end' | 'auto-start' | 'bottom' | 'bottom-end' | 'bottom-start' | 'left' | 'left-end' | 'left-start' | 'right' | 'right-end' | 'right-start' | 'top' | 'top-end' | 'top-start';
143
+
144
+ // (No @packageDocumentation comment for this package)
145
+
146
+ ```