@atlaskit/dropdown-menu 11.5.0 → 11.5.1

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.
Files changed (30) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/version.json +1 -1
  3. package/dist/es2019/version.json +1 -1
  4. package/dist/esm/version.json +1 -1
  5. package/dist/types-ts4.0/checkbox/dropdown-item-checkbox-group.d.ts +16 -0
  6. package/dist/types-ts4.0/checkbox/dropdown-item-checkbox.d.ts +13 -0
  7. package/dist/types-ts4.0/dropdown-menu-item-group.d.ts +11 -0
  8. package/dist/types-ts4.0/dropdown-menu-item.d.ts +13 -0
  9. package/dist/types-ts4.0/dropdown-menu.d.ts +13 -0
  10. package/dist/types-ts4.0/index.d.ts +8 -0
  11. package/dist/types-ts4.0/internal/components/focus-manager.d.ts +19 -0
  12. package/dist/types-ts4.0/internal/components/menu-wrapper.d.ts +11 -0
  13. package/dist/types-ts4.0/internal/context/checkbox-group-context.d.ts +5 -0
  14. package/dist/types-ts4.0/internal/context/selection-store.d.ts +27 -0
  15. package/dist/types-ts4.0/internal/hooks/use-checkbox-state.d.ts +17 -0
  16. package/dist/types-ts4.0/internal/hooks/use-radio-state.d.ts +12 -0
  17. package/dist/types-ts4.0/internal/hooks/use-register-item-with-focus-manager.d.ts +4 -0
  18. package/dist/types-ts4.0/internal/utils/get-icon-colors.d.ts +8 -0
  19. package/dist/types-ts4.0/internal/utils/handle-focus.d.ts +2 -0
  20. package/dist/types-ts4.0/internal/utils/is-checkbox-item.d.ts +1 -0
  21. package/dist/types-ts4.0/internal/utils/is-radio-item.d.ts +1 -0
  22. package/dist/types-ts4.0/internal/utils/is-voice-over-supported.d.ts +2 -0
  23. package/dist/types-ts4.0/internal/utils/reset-options-in-group.d.ts +4 -0
  24. package/dist/types-ts4.0/internal/utils/use-generated-id.d.ts +5 -0
  25. package/dist/types-ts4.0/radio/dropdown-item-radio-group.d.ts +25 -0
  26. package/dist/types-ts4.0/radio/dropdown-item-radio.d.ts +13 -0
  27. package/dist/types-ts4.0/types.d.ts +289 -0
  28. package/dist/types-ts4.0/visual-regression/index.d.ts +1 -0
  29. package/package.json +13 -6
  30. package/types/package.json +8 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/dropdown-menu
2
2
 
3
+ ## 11.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`8cc2f888c83`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cc2f888c83) - Upgrade Typescript from `4.3.5` to `4.5.5`
8
+
3
9
  ## 11.5.0
4
10
 
5
11
  ### Minor Changes
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/dropdown-menu",
3
- "version": "11.5.0",
3
+ "version": "11.5.1",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/dropdown-menu",
3
- "version": "11.5.0",
3
+ "version": "11.5.1",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/dropdown-menu",
3
- "version": "11.5.0",
3
+ "version": "11.5.1",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,16 @@
1
+ /// <reference types="react" />
2
+ import type { SectionProps } from '@atlaskit/menu';
3
+ interface DropdownItemCheckboxGroupProps extends SectionProps {
4
+ /**
5
+ * Unique identifier for the checkbox group.
6
+ */
7
+ id: string;
8
+ }
9
+ /**
10
+ * __Dropdown item checkbox group__
11
+ *
12
+ * A wrapping element for dropdown menu checkbox items.
13
+ *
14
+ */
15
+ declare const DropdownItemCheckboxGroup: (props: DropdownItemCheckboxGroupProps) => JSX.Element;
16
+ export default DropdownItemCheckboxGroup;
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ import { DropdownItemCheckboxProps } from '../types';
3
+ /**
4
+ * __Dropdown item checkbox__
5
+ *
6
+ * A dropdown item checkbox creates groups that have multiple selections.
7
+ *
8
+ * - [Examples](https://atlassian.design/components/dropdown-menu/dropdown-item-checkbox/examples)
9
+ * - [Code](https://atlassian.design/components/dropdown-menu/dropdown-item-checkbox/code)
10
+ * - [Usage](https://atlassian.design/components/dropdown-menu/dropdown-item-checkbox/usage)
11
+ */
12
+ declare const DropdownItemCheckbox: (props: DropdownItemCheckboxProps) => JSX.Element;
13
+ export default DropdownItemCheckbox;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * __Section__
3
+ *
4
+ * A dropdown item group includes all the actions or items in a dropdown menu.
5
+ *
6
+ * - [Examples](https://atlassian.design/components/dropdown-menu/dropdown-item-group/examples)
7
+ * - [Code](https://atlassian.design/components/dropdown-menu/dropdown-item-group/code)
8
+ * - [Usage](https://atlassian.design/components/dropdown-menu/dropdown-item-group/usage)
9
+ */
10
+ import Section from '@atlaskit/menu/section';
11
+ export default Section;
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ import { DropdownItemProps } from './types';
3
+ /**
4
+ * __Dropdown menu item__
5
+ *
6
+ * A dropdown item populates the dropdown menu with items. Every item should be inside a dropdown item group.
7
+ *
8
+ * - [Examples](https://atlassian.design/components/dropdown-item/examples)
9
+ * - [Code](https://atlassian.design/components/dropdown-item/code)
10
+ * - [Usage](https://atlassian.design/components/dropdown-item/usage)
11
+ */
12
+ declare const DropdownMenuItem: (props: DropdownItemProps) => JSX.Element;
13
+ export default DropdownMenuItem;
@@ -0,0 +1,13 @@
1
+ import { jsx } from '@emotion/react';
2
+ import type { DropdownMenuProps } from './types';
3
+ /**
4
+ * __Dropdown menu__
5
+ *
6
+ * A dropdown menu displays a list of actions or options to a user.
7
+ *
8
+ * - [Examples](https://atlassian.design/components/dropdown-menu/examples)
9
+ * - [Code](https://atlassian.design/components/dropdown-menu/code)
10
+ * - [Usage](https://atlassian.design/components/dropdown-menu/usage)
11
+ */
12
+ declare const DropdownMenu: <T extends HTMLElement = HTMLElement>(props: DropdownMenuProps<T>) => jsx.JSX.Element;
13
+ export default DropdownMenu;
@@ -0,0 +1,8 @@
1
+ export { default } from './dropdown-menu';
2
+ export { default as DropdownItemGroup } from './dropdown-menu-item-group';
3
+ export { default as DropdownItem } from './dropdown-menu-item';
4
+ export { default as DropdownItemCheckbox } from './checkbox/dropdown-item-checkbox';
5
+ export { default as DropdownItemCheckboxGroup } from './checkbox/dropdown-item-checkbox-group';
6
+ export { default as DropdownItemRadio } from './radio/dropdown-item-radio';
7
+ export { default as DropdownItemRadioGroup } from './radio/dropdown-item-radio-group';
8
+ export type { DropdownMenuProps, DropdownMenuGroupProps, DropdownItemProps, OnOpenChangeArgs, CustomTriggerProps, } from './types';
@@ -0,0 +1,19 @@
1
+ import React, { FC } from 'react';
2
+ import { FocusableElement } from '../../types';
3
+ /**
4
+ *
5
+ *
6
+ * Context provider which maintains the list of focusable elements and a method to
7
+ * register new menu items.
8
+ * This list drives the keyboard navgation of the menu.
9
+ *
10
+ */
11
+ export declare const FocusManagerContext: React.Context<{
12
+ menuItemRefs: FocusableElement[];
13
+ registerRef: (ref: FocusableElement) => void;
14
+ }>;
15
+ /**
16
+ * Focus manager logic
17
+ */
18
+ declare const FocusManager: FC;
19
+ export default FocusManager;
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { MenuWrapperProps } from '../../types';
3
+ /**
4
+ *
5
+ * MenuWrapper wraps all the menu items.
6
+ * It handles the logic to close the menu when a MenuItem is clicked, but leaves it open
7
+ * if a CheckboxItem or RadioItem is clicked.
8
+ * It also sets focus to the first menu item when opened.
9
+ */
10
+ declare const MenuWrapper: ({ onClose, setInitialFocusRef, ...props }: MenuWrapperProps) => JSX.Element;
11
+ export default MenuWrapper;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * Holds the unique identifier for the checkbox group.
4
+ */
5
+ export declare const CheckboxGroupContext: import("react").Context<string>;
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ declare type OptionsInGroup = {
3
+ [key: string]: boolean | undefined;
4
+ };
5
+ declare type SelectionStoreContextProps = {
6
+ setItemState: (group: string, id: string, value: boolean | undefined) => void;
7
+ getItemState: (group: string, id: string) => boolean | undefined;
8
+ setGroupState: (group: string, value: OptionsInGroup) => void;
9
+ getGroupState: (group: string) => OptionsInGroup;
10
+ };
11
+ /**
12
+ *
13
+ * SelectionStoreContext maintains the state of the selected items
14
+ * and getter setters.
15
+ *
16
+ */
17
+ export declare const SelectionStoreContext: React.Context<SelectionStoreContextProps>;
18
+ declare type SelectionStoreProps = {
19
+ children: React.ReactNode;
20
+ };
21
+ /**
22
+ * Selection store will persist data as long as it remains mounted.
23
+ * It handles the uncontrolled story for dropdown menu when the menu
24
+ * items can be mounted/unmounted depending if the menu is open or closed.
25
+ */
26
+ declare const SelectionStore: (props: SelectionStoreProps) => JSX.Element;
27
+ export default SelectionStore;
@@ -0,0 +1,17 @@
1
+ declare type CheckboxStateArgs = {
2
+ id: string;
3
+ isSelected: boolean | undefined;
4
+ defaultSelected: boolean | undefined;
5
+ };
6
+ declare type SetStateCallback = (value: boolean | undefined) => boolean;
7
+ declare type CheckboxStateValue = [
8
+ boolean,
9
+ (newValue: SetStateCallback) => void
10
+ ];
11
+ /**
12
+ * Custom hook to handle checkbox state for dropdown menu.
13
+ * It works in tandem with the selection store context when the
14
+ * component is uncontrolled.
15
+ */
16
+ declare const useCheckboxState: ({ isSelected, id, defaultSelected, }: CheckboxStateArgs) => CheckboxStateValue;
17
+ export default useCheckboxState;
@@ -0,0 +1,12 @@
1
+ declare type RadioStateArgs = {
2
+ id: string;
3
+ isSelected: boolean | undefined;
4
+ defaultSelected: boolean | undefined;
5
+ };
6
+ declare type SetStateCallback = (value: boolean | undefined) => boolean;
7
+ declare type RadioStateValue = [
8
+ boolean,
9
+ (newValue: SetStateCallback) => void
10
+ ];
11
+ declare function useRadioState({ id, isSelected, defaultSelected, }: RadioStateArgs): RadioStateValue;
12
+ export default useRadioState;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { FocusableElement } from '../../types';
3
+ declare function useRegisterItemWithFocusManager(): import("react").RefObject<FocusableElement>;
4
+ export default useRegisterItemWithFocusManager;
@@ -0,0 +1,8 @@
1
+ declare const getIconColors: (isSelected: boolean | undefined) => {
2
+ primary: "var(--ds-background-brand-bold)";
3
+ secondary: "var(--ds-icon-inverse)";
4
+ } | {
5
+ primary: "var(--ds-background-neutral)";
6
+ secondary: "var(--ds-UNSAFE_util-transparent)";
7
+ };
8
+ export default getIconColors;
@@ -0,0 +1,2 @@
1
+ import { FocusableElement } from '../../types';
2
+ export default function handleFocus(refs: Array<FocusableElement>): (e: KeyboardEvent) => void;
@@ -0,0 +1 @@
1
+ export default function isCheckboxItem(element: HTMLElement): boolean;
@@ -0,0 +1 @@
1
+ export default function isCheckboxItem(element: HTMLElement): boolean;
@@ -0,0 +1,2 @@
1
+ declare const isVoiceOverSupported: () => boolean;
2
+ export default isVoiceOverSupported;
@@ -0,0 +1,4 @@
1
+ declare const resetOptionsInGroup: (group: {
2
+ [key: string]: boolean | undefined;
3
+ }) => {};
4
+ export default resetOptionsInGroup;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * useGeneratedId generates a random string which remains constant across
3
+ * renders when called without any parameter.
4
+ */
5
+ export default function useGeneratedId(): string;
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import type { SectionProps } from '@atlaskit/menu';
3
+ interface DropdownItemRadioGroupProps extends SectionProps {
4
+ id: string;
5
+ }
6
+ interface RadioGroupContextProps {
7
+ id: string;
8
+ radioGroupState: {
9
+ [key: string]: boolean | undefined;
10
+ };
11
+ selectRadioItem: (id: string, value: boolean) => void;
12
+ }
13
+ /**
14
+ * __Radio group context__
15
+ * Context provider that wraps each DropdownItemRadioGroup
16
+ */
17
+ export declare const RadioGroupContext: React.Context<RadioGroupContextProps>;
18
+ /**
19
+ * __Dropdown item radio group__
20
+ * Store which manages the selection state for each DropdownItemRadio
21
+ * across mount and unmounts.
22
+ *
23
+ */
24
+ declare const DropdownItemRadioGroup: (props: DropdownItemRadioGroupProps) => JSX.Element;
25
+ export default DropdownItemRadioGroup;
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ import { DropdownItemRadioProps } from '../types';
3
+ /**
4
+ * __Dropdown item radio__
5
+ *
6
+ * A dropdown item radio displays groups that have a single selection.
7
+ *
8
+ * - [Examples](https://atlassian.design/components/dropdown-menu/dropdown-item-radio/examples)
9
+ * - [Code](https://atlassian.design/components/dropdown-menu/dropdown-item-radio/code)
10
+ * - [Usage](https://atlassian.design/components/dropdown-menu/dropdown-item-radio/usage)
11
+ */
12
+ declare const DropdownItemRadio: (props: DropdownItemRadioProps) => JSX.Element;
13
+ export default DropdownItemRadio;
@@ -0,0 +1,289 @@
1
+ import { KeyboardEvent, MouseEvent, ReactElement, ReactNode, Ref } from 'react';
2
+ import type { CustomItemProps, MenuGroupProps, SectionProps } from '@atlaskit/menu/types';
3
+ import type { ContentProps, TriggerProps } from '@atlaskit/popup/types';
4
+ export declare type FocusableElement = HTMLAnchorElement | HTMLButtonElement;
5
+ export declare type Action = 'next' | 'prev' | 'first' | 'last';
6
+ export declare type Placement = 'auto-start' | 'auto' | 'auto-end' | 'top-start' | 'top' | 'top-end' | 'right-start' | 'right' | 'right-end' | 'bottom-end' | 'bottom' | 'bottom-start' | 'left-end' | 'left' | 'left-start';
7
+ export declare type ItemId = string;
8
+ export declare type GroupId = string;
9
+ export declare type CachedItem = {
10
+ id: ItemId;
11
+ groupId: GroupId;
12
+ };
13
+ export declare type FocusItem = {
14
+ itemId: ItemId;
15
+ itemNode: HTMLElement;
16
+ };
17
+ export declare type Behaviors = 'checkbox' | 'radio' | 'menuitemcheckbox' | 'menuitemradio';
18
+ export interface CustomTriggerProps<TriggerElement extends HTMLElement = HTMLElement> extends Omit<TriggerProps, 'ref'> {
19
+ /**
20
+ * Ref that should be applied to the trigger. This is used to calculate the menu position.
21
+ */
22
+ triggerRef: Ref<TriggerElement>;
23
+ /**
24
+ * Makes the trigger appear selected.
25
+ */
26
+ isSelected?: boolean;
27
+ /**
28
+ * Event that is triggered when the element is clicked.
29
+ */
30
+ onClick?: (e: MouseEvent | KeyboardEvent) => void;
31
+ /**
32
+ * A `testId` prop is provided for specified elements, which is a unique
33
+ * string that appears as a data attribute `data-testid` in the rendered code,
34
+ * serving as a hook for automated tests.
35
+ *
36
+ * As dropdown-menu is composed of different components, we passed down the testId to the sub component you want to test:
37
+ * - `testId--trigger` to get the menu trigger.
38
+ * - `testId--content` to get the dropdown content trigger.
39
+ */
40
+ testId?: string;
41
+ }
42
+ export interface OnOpenChangeArgs {
43
+ isOpen: boolean;
44
+ event: MouseEvent | KeyboardEvent;
45
+ }
46
+ export interface MenuWrapperProps extends MenuGroupProps {
47
+ setInitialFocusRef?: ContentProps['setInitialFocusRef'];
48
+ onClose?: ContentProps['onClose'];
49
+ }
50
+ export interface DropdownMenuGroupProps extends SectionProps {
51
+ }
52
+ export interface DropdownMenuProps<TriggerElement extends HTMLElement = HTMLElement> {
53
+ /**
54
+ * Controls the appearance of the menu.
55
+ * Default menu has scroll after its height exceeds the pre-defined amount.
56
+ * Tall menu has no scroll until the height exceeds the height of the viewport.
57
+ */
58
+ appearance?: 'default' | 'tall';
59
+ /**
60
+ * Controls if the first menu item receives focus when menu is opened. Note that the menu has a focus lock
61
+ * which traps the focus within the menu. Also, the first item gets fouced automatically
62
+ * if the menu is triggered using the keyboard.
63
+ *
64
+ */
65
+ autoFocus?: boolean;
66
+ /**
67
+ * Content that will be rendered inside the layer element. Should typically be
68
+ * `DropdownItemGroup` or `DropdownItem`, or checkbox / radio variants of those.
69
+ */
70
+ children?: ReactNode;
71
+ /**
72
+ * If true, a Spinner is rendered instead of the items
73
+ */
74
+ isLoading?: boolean;
75
+ /**
76
+ * Text to be used as status for assistive technologies. Defaults to "Loading".
77
+ */
78
+ statusLabel?: string;
79
+ /**
80
+ * Controls the open state of the dropdown.
81
+ */
82
+ isOpen?: boolean;
83
+ /**
84
+ * Position of the menu.
85
+ */
86
+ placement?: Placement;
87
+ /**
88
+ * Allows the dropdown menu to be placed on the opposite side of its trigger if it does not
89
+ * fit in the viewport.
90
+ */
91
+ shouldFlip?: boolean;
92
+ /**
93
+ * Content which will trigger the dropdown menu to open and close. Use with `triggerType`
94
+ * to easily get a button trigger.
95
+ */
96
+ trigger?: string | ((triggerButtonProps: CustomTriggerProps<TriggerElement>) => ReactElement);
97
+ /**
98
+ * A `testId` prop is provided for specified elements, which is a unique
99
+ * string that appears as a data attribute `data-testid` in the rendered code,
100
+ * serving as a hook for automated tests.
101
+ *
102
+ * As dropdown-menu is composed of different components, we passed down the testId to the sub component you want to test:
103
+ * - `testId--trigger` to get the menu trigger.
104
+ * - `testId--content` to get the dropdown content trigger.
105
+ */
106
+ testId?: string;
107
+ /**
108
+ * Controls the initial open state of the dropdown. If provided, the component is considered to be controlled
109
+ * which means that the user is responsible for managing the open and close state of the menu.
110
+ */
111
+ defaultOpen?: boolean;
112
+ /**
113
+ * Called when the menu should be open/closed. Receives an object with `isOpen` state.
114
+ */
115
+ onOpenChange?: (args: OnOpenChangeArgs) => void;
116
+ /**
117
+ * Z-index that the popup should be displayed in.
118
+ * This is passed to the portal component.
119
+ * Defaults to `layers.modal()` from `@atlaskit/theme` which is 510.
120
+ */
121
+ zIndex?: number;
122
+ }
123
+ export interface DropdownItemProps {
124
+ /**
125
+ * Primary content for the item.
126
+ */
127
+ children: React.ReactNode;
128
+ /**
129
+ * Custom component to render as an item.
130
+ */
131
+ component?: CustomItemProps['component'];
132
+ /**
133
+ * Description of the item.
134
+ * This will render smaller text below the primary text of the item as well as slightly increasing the height of the item.
135
+ */
136
+ description?: string | JSX.Element;
137
+ /**
138
+ * Makes the element appear disabled as well as removing interactivity.
139
+ */
140
+ isDisabled?: boolean;
141
+ /**
142
+ * When `true` the title of the item will wrap multiple lines if it's long enough.
143
+ */
144
+ shouldTitleWrap?: boolean;
145
+ /**
146
+ * When `true` the description of the item will wrap multiple lines if it's long enough.
147
+ */
148
+ shouldDescriptionWrap?: boolean;
149
+ /**
150
+ * Event that is triggered when the element is clicked.
151
+ */
152
+ onClick?: (e: MouseEvent | KeyboardEvent) => void;
153
+ /**
154
+ * Makes the element appear selected.
155
+ */
156
+ isSelected?: boolean;
157
+ /**
158
+ * Link to another page.
159
+ */
160
+ href?: string;
161
+ /**
162
+ * Where to display the linked URL,
163
+ * see [anchor information](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a) on mdn for more information.
164
+ */
165
+ target?: string;
166
+ /**
167
+ * Adds a title attribute to the root item element.
168
+ */
169
+ title?: string;
170
+ /**
171
+ * Element to render before the item text.
172
+ * Generally should be an [icon](https://atlaskit.atlassian.com/packages/design-system/icon) component.
173
+ */
174
+ elemBefore?: React.ReactNode;
175
+ /**
176
+ * Element to render after the item text.
177
+ * Generally should be an [icon](https://atlaskit.atlassian.com/packages/design-system/icon) component.
178
+ */
179
+ elemAfter?: React.ReactNode;
180
+ /**
181
+ * The relationship of the linked URL as space-separated link types.
182
+ * Generally you'll want to set this to "noopener noreferrer" when `target` is "_blank".
183
+ */
184
+ rel?: string;
185
+ /**
186
+ * A `testId` prop is provided for specified elements,
187
+ * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
188
+ * serving as a hook for automated tests.
189
+ */
190
+ testId?: string;
191
+ }
192
+ export interface DropdownItemCheckboxProps {
193
+ /**
194
+ * Primary content for the item.
195
+ */
196
+ children: React.ReactNode;
197
+ /**
198
+ * Description of the item.
199
+ * This will render smaller text below the primary text of the item as well as slightly increasing the height of the item.
200
+ */
201
+ description?: string | JSX.Element;
202
+ /**
203
+ * Makes the checkbox appear disabled as well as removing interactivity.
204
+ */
205
+ isDisabled?: boolean;
206
+ /**
207
+ * When `true` the title of the item will wrap multiple lines if it's long enough.
208
+ */
209
+ shouldTitleWrap?: boolean;
210
+ /**
211
+ * When `true` the description of the item will wrap multiple lines if it's long enough.
212
+ */
213
+ shouldDescriptionWrap?: boolean;
214
+ /**
215
+ * Event that is triggered when the checkbox is clicked.
216
+ */
217
+ onClick?: (e: MouseEvent | KeyboardEvent) => void;
218
+ /**
219
+ * Sets whether the checkbox is checked or unchecked.
220
+ */
221
+ isSelected?: boolean;
222
+ /**
223
+ * Sets whether the checkbox begins selected.
224
+ */
225
+ defaultSelected?: boolean;
226
+ /**
227
+ * Unique id of a checkbox
228
+ */
229
+ id: string;
230
+ /**
231
+ * Adds a title attribute to the root item element.
232
+ */
233
+ title?: string;
234
+ /**
235
+ * A `testId` prop is provided for specified elements,
236
+ * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
237
+ * serving as a hook for automated tests.
238
+ */
239
+ testId?: string;
240
+ }
241
+ export interface DropdownItemRadioProps {
242
+ /**
243
+ * Primary content for the item.
244
+ */
245
+ children: React.ReactNode;
246
+ /**
247
+ * Description of the item.
248
+ * This will render smaller text below the primary text of the item as well as slightly increasing the height of the item.
249
+ */
250
+ description?: string | JSX.Element;
251
+ /**
252
+ * Makes the checkbox appear disabled as well as removing interactivity.
253
+ */
254
+ isDisabled?: boolean;
255
+ /**
256
+ * When `true` the title of the item will wrap multiple lines if it's long enough.
257
+ */
258
+ shouldTitleWrap?: boolean;
259
+ /**
260
+ * When `true` the description of the item will wrap multiple lines if it's long enough.
261
+ */
262
+ shouldDescriptionWrap?: boolean;
263
+ /**
264
+ * Event that is triggered when the checkbox is clicked.
265
+ */
266
+ onClick?: (e: MouseEvent | KeyboardEvent) => void;
267
+ /**
268
+ * Sets whether the checkbox is checked or unchecked.
269
+ */
270
+ isSelected?: boolean;
271
+ /**
272
+ * Sets whether the checkbox begins selected.
273
+ */
274
+ defaultSelected?: boolean;
275
+ /**
276
+ * Unique id of a checkbox
277
+ */
278
+ id: string;
279
+ /**
280
+ * Adds a title attribute to the root item element.
281
+ */
282
+ title?: string;
283
+ /**
284
+ * A `testId` prop is provided for specified elements,
285
+ * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
286
+ * serving as a hook for automated tests.
287
+ */
288
+ testId?: string;
289
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/dropdown-menu",
3
- "version": "11.5.0",
3
+ "version": "11.5.1",
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/"
@@ -12,6 +12,13 @@
12
12
  "module": "dist/esm/index.js",
13
13
  "module:es2019": "dist/es2019/index.js",
14
14
  "types": "dist/types/index.d.ts",
15
+ "typesVersions": {
16
+ ">=4.0 <4.5": {
17
+ "*": [
18
+ "dist/types-ts4.0/*"
19
+ ]
20
+ }
21
+ },
15
22
  "sideEffects": false,
16
23
  "atlaskit:src": "src/index.tsx",
17
24
  "atlassian": {
@@ -44,7 +51,7 @@
44
51
  "devDependencies": {
45
52
  "@atlaskit/avatar": "^21.0.0",
46
53
  "@atlaskit/docs": "*",
47
- "@atlaskit/lozenge": "11.2.0",
54
+ "@atlaskit/lozenge": "11.2.2",
48
55
  "@atlaskit/modal-dialog": "^12.3.0",
49
56
  "@atlaskit/section-message": "^6.2.0",
50
57
  "@atlaskit/ssr": "*",
@@ -52,15 +59,15 @@
52
59
  "@atlaskit/visual-regression": "*",
53
60
  "@atlaskit/webdriver-runner": "*",
54
61
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
55
- "@testing-library/dom": "^7.7.3",
56
- "@testing-library/react": "^8.0.1",
57
- "@testing-library/react-hooks": "^1.0.4",
62
+ "@testing-library/dom": "^8.17.1",
63
+ "@testing-library/react": "^12.1.5",
64
+ "@testing-library/react-hooks": "^8.0.1",
58
65
  "jscodeshift": "^0.13.0",
59
66
  "raf-stub": "^2.0.1",
60
67
  "react-dom": "^16.8.0",
61
68
  "storybook-addon-performance": "^0.16.0",
62
69
  "tiny-invariant": "^1.2.0",
63
- "typescript": "4.3.5"
70
+ "typescript": "4.5.5"
64
71
  },
65
72
  "keywords": [
66
73
  "atlaskit",
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/types.js",
5
5
  "module:es2019": "../dist/es2019/types.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/types.d.ts"
7
+ "types": "../dist/types/types.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/types.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }