@atlaskit/dropdown-menu 10.1.8 → 11.0.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/CHANGELOG.md +148 -0
- package/__perf__/default.tsx +1 -1
- package/__perf__/dropdown-menu.tsx +216 -0
- package/codemods/11.0.0-lite-mode.tsx +39 -0
- package/codemods/__tests__/11.0.0-lite-mode.test.tsx +48 -0
- package/codemods/__tests__/convert-position.test.tsx +88 -0
- package/codemods/__tests__/convert-triggerType.test.tsx +100 -0
- package/codemods/__tests__/deprecate-items.test.tsx +108 -0
- package/codemods/__tests__/deprecate-onItemActivated.test.tsx +108 -0
- package/codemods/__tests__/deprecate-onPositioned.test.tsx +108 -0
- package/codemods/__tests__/deprecate-shouldFitContainer.tsx +108 -0
- package/codemods/__tests__/rename-imports.tsx +136 -0
- package/codemods/__tests__/replace-position-to-placement.test.tsx +84 -0
- package/codemods/__tests__/replace-shouldAllowMultipleLine.test.tsx +122 -0
- package/codemods/__tests__/update-component-callsites.tsx +66 -0
- package/codemods/migrates/convert-trigger-type.tsx +57 -0
- package/codemods/migrates/deprecate-items.tsx +9 -0
- package/codemods/migrates/deprecate-onItemActivated.tsx +9 -0
- package/codemods/migrates/deprecate-onPositioned.tsx +9 -0
- package/codemods/migrates/deprecate-shouldFitContainer.tsx +9 -0
- package/codemods/migrates/rename-imports.tsx +22 -0
- package/codemods/migrates/replace-position-to-placement.tsx +38 -0
- package/codemods/migrates/replace-shouldAllowMultiline.tsx +47 -0
- package/codemods/migrates/update-component-callsites.tsx +13 -0
- package/codemods/utils/convert-position.tsx +24 -0
- package/codemods/utils/create-rename-import.tsx +41 -0
- package/codemods/utils/create-update-callsite.tsx +32 -0
- package/dist/cjs/checkbox/dropdown-item-checkbox-group.js +31 -0
- package/dist/cjs/checkbox/dropdown-item-checkbox.js +108 -0
- package/dist/cjs/dropdown-menu-item-group.js +22 -0
- package/dist/cjs/dropdown-menu-item.js +67 -0
- package/dist/cjs/dropdown-menu.js +194 -0
- package/dist/cjs/index.js +21 -29
- package/dist/cjs/{components/item/DropdownItemRadio.js → internal/components/focus-manager.js} +40 -9
- package/dist/cjs/internal/components/menu-wrapper.js +68 -0
- package/dist/cjs/internal/context/checkbox-group-context.js +14 -0
- package/dist/cjs/internal/context/selection-store.js +76 -0
- package/dist/cjs/internal/hooks/use-checkbox-state.js +68 -0
- package/dist/cjs/internal/hooks/use-radio-state.js +84 -0
- package/dist/cjs/internal/hooks/use-register-item-with-focus-manager.js +29 -0
- package/dist/cjs/internal/utils/get-icon-colors.js +25 -0
- package/dist/cjs/internal/utils/handle-focus.js +58 -0
- package/dist/cjs/internal/utils/is-checkbox-item.js +11 -0
- package/dist/cjs/internal/utils/is-radio-item.js +11 -0
- package/dist/cjs/internal/utils/is-voice-over-supported.js +23 -0
- package/dist/cjs/internal/utils/reset-options-in-group.js +23 -0
- package/dist/cjs/radio/dropdown-item-radio-group.js +89 -0
- package/dist/cjs/radio/dropdown-item-radio.js +108 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/checkbox/dropdown-item-checkbox-group.js +21 -0
- package/dist/es2019/checkbox/dropdown-item-checkbox.js +67 -0
- package/dist/es2019/dropdown-menu-item-group.js +11 -0
- package/dist/es2019/dropdown-menu-item.js +49 -0
- package/dist/es2019/dropdown-menu.js +151 -0
- package/dist/es2019/index.js +7 -11
- package/dist/es2019/internal/components/focus-manager.js +40 -0
- package/dist/es2019/internal/components/menu-wrapper.js +44 -0
- package/dist/es2019/internal/context/checkbox-group-context.js +6 -0
- package/dist/es2019/internal/context/selection-store.js +54 -0
- package/dist/es2019/internal/hooks/use-checkbox-state.js +45 -0
- package/dist/es2019/internal/hooks/use-radio-state.js +56 -0
- package/dist/es2019/internal/hooks/use-register-item-with-focus-manager.js +19 -0
- package/dist/es2019/internal/utils/get-icon-colors.js +17 -0
- package/dist/es2019/internal/utils/handle-focus.js +48 -0
- package/dist/es2019/internal/utils/is-checkbox-item.js +4 -0
- package/dist/es2019/internal/utils/is-radio-item.js +4 -0
- package/dist/es2019/internal/utils/is-voice-over-supported.js +11 -0
- package/dist/es2019/internal/utils/reset-options-in-group.js +7 -0
- package/dist/es2019/radio/dropdown-item-radio-group.js +56 -0
- package/dist/es2019/radio/dropdown-item-radio.js +67 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/checkbox/dropdown-item-checkbox-group.js +19 -0
- package/dist/esm/checkbox/dropdown-item-checkbox.js +81 -0
- package/dist/esm/dropdown-menu-item-group.js +11 -0
- package/dist/esm/dropdown-menu-item.js +52 -0
- package/dist/esm/dropdown-menu.js +168 -0
- package/dist/esm/index.js +7 -11
- package/dist/esm/internal/components/focus-manager.js +39 -0
- package/dist/esm/internal/components/menu-wrapper.js +45 -0
- package/dist/esm/internal/context/checkbox-group-context.js +6 -0
- package/dist/esm/internal/context/selection-store.js +58 -0
- package/dist/esm/internal/hooks/use-checkbox-state.js +55 -0
- package/dist/esm/internal/hooks/use-radio-state.js +70 -0
- package/dist/esm/internal/hooks/use-register-item-with-focus-manager.js +19 -0
- package/dist/esm/internal/utils/get-icon-colors.js +17 -0
- package/dist/esm/internal/utils/handle-focus.js +47 -0
- package/dist/esm/internal/utils/is-checkbox-item.js +4 -0
- package/dist/esm/internal/utils/is-radio-item.js +4 -0
- package/dist/esm/internal/utils/is-voice-over-supported.js +15 -0
- package/dist/esm/internal/utils/reset-options-in-group.js +13 -0
- package/dist/esm/radio/dropdown-item-radio-group.js +66 -0
- package/dist/esm/radio/dropdown-item-radio.js +81 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/checkbox/dropdown-item-checkbox-group.d.ts +16 -0
- package/dist/types/checkbox/dropdown-item-checkbox.d.ts +13 -0
- package/dist/types/dropdown-menu-item-group.d.ts +11 -0
- package/dist/types/dropdown-menu-item.d.ts +13 -0
- package/dist/types/dropdown-menu.d.ts +13 -0
- package/dist/types/index.d.ts +8 -10
- package/dist/types/internal/components/focus-manager.d.ts +19 -0
- package/dist/types/internal/components/menu-wrapper.d.ts +11 -0
- package/dist/types/internal/context/checkbox-group-context.d.ts +5 -0
- package/dist/types/internal/context/selection-store.d.ts +27 -0
- package/dist/types/internal/hooks/use-checkbox-state.d.ts +14 -0
- package/dist/types/internal/hooks/use-radio-state.d.ts +9 -0
- package/dist/types/internal/hooks/use-register-item-with-focus-manager.d.ts +4 -0
- package/dist/types/internal/utils/get-icon-colors.d.ts +8 -0
- package/dist/types/internal/utils/handle-focus.d.ts +2 -0
- package/dist/types/internal/utils/is-checkbox-item.d.ts +1 -0
- package/dist/types/internal/utils/is-radio-item.d.ts +1 -0
- package/dist/types/internal/utils/is-voice-over-supported.d.ts +2 -0
- package/dist/types/internal/utils/reset-options-in-group.d.ts +4 -0
- package/dist/types/radio/dropdown-item-radio-group.d.ts +25 -0
- package/dist/types/radio/dropdown-item-radio.d.ts +13 -0
- package/dist/types/types.d.ts +254 -79
- package/package.json +39 -23
- package/dist/cjs/components/DropdownMenu.js +0 -230
- package/dist/cjs/components/DropdownMenuStateless.js +0 -523
- package/dist/cjs/components/context/DropdownItemClickManager.js +0 -72
- package/dist/cjs/components/context/DropdownItemFocusManager.js +0 -178
- package/dist/cjs/components/context/DropdownItemSelectionCache.js +0 -131
- package/dist/cjs/components/context/DropdownItemSelectionManager.js +0 -185
- package/dist/cjs/components/group/DropdownItemGroup.js +0 -61
- package/dist/cjs/components/group/DropdownItemGroupCheckbox.js +0 -16
- package/dist/cjs/components/group/DropdownItemGroupRadio.js +0 -16
- package/dist/cjs/components/group/ert-group-selection.js +0 -8
- package/dist/cjs/components/hoc/withItemSelectionManager.js +0 -66
- package/dist/cjs/components/hoc/withToggleInteraction.js +0 -175
- package/dist/cjs/components/item/DropdownItem.js +0 -19
- package/dist/cjs/components/item/DropdownItemCheckbox.js +0 -28
- package/dist/cjs/components/item/ert-item-checkbox.js +0 -8
- package/dist/cjs/components/item/ert-item-radio.js +0 -8
- package/dist/cjs/components/item/ert-item.js +0 -8
- package/dist/cjs/styled/WidthConstrainer.js +0 -21
- package/dist/cjs/util/contextNamespace.js +0 -19
- package/dist/cjs/util/getDisplayName.js +0 -14
- package/dist/cjs/util/keys.js +0 -18
- package/dist/cjs/util/safeContextCall.js +0 -27
- package/dist/cjs/util/supportsVoiceover.js +0 -17
- package/dist/es2019/components/DropdownMenu.js +0 -156
- package/dist/es2019/components/DropdownMenuStateless.js +0 -459
- package/dist/es2019/components/context/DropdownItemClickManager.js +0 -31
- package/dist/es2019/components/context/DropdownItemFocusManager.js +0 -134
- package/dist/es2019/components/context/DropdownItemSelectionCache.js +0 -68
- package/dist/es2019/components/context/DropdownItemSelectionManager.js +0 -140
- package/dist/es2019/components/group/DropdownItemGroup.js +0 -17
- package/dist/es2019/components/group/DropdownItemGroupCheckbox.js +0 -3
- package/dist/es2019/components/group/DropdownItemGroupRadio.js +0 -3
- package/dist/es2019/components/group/ert-group-selection.js +0 -1
- package/dist/es2019/components/hoc/withItemSelectionManager.js +0 -20
- package/dist/es2019/components/hoc/withToggleInteraction.js +0 -119
- package/dist/es2019/components/item/DropdownItem.js +0 -3
- package/dist/es2019/components/item/DropdownItemCheckbox.js +0 -5
- package/dist/es2019/components/item/DropdownItemRadio.js +0 -5
- package/dist/es2019/components/item/ert-item-checkbox.js +0 -1
- package/dist/es2019/components/item/ert-item-radio.js +0 -1
- package/dist/es2019/components/item/ert-item.js +0 -1
- package/dist/es2019/styled/WidthConstrainer.js +0 -6
- package/dist/es2019/util/contextNamespace.js +0 -6
- package/dist/es2019/util/getDisplayName.js +0 -4
- package/dist/es2019/util/keys.js +0 -6
- package/dist/es2019/util/safeContextCall.js +0 -10
- package/dist/es2019/util/supportsVoiceover.js +0 -5
- package/dist/esm/components/DropdownMenu.js +0 -215
- package/dist/esm/components/DropdownMenuStateless.js +0 -516
- package/dist/esm/components/context/DropdownItemClickManager.js +0 -59
- package/dist/esm/components/context/DropdownItemFocusManager.js +0 -164
- package/dist/esm/components/context/DropdownItemSelectionCache.js +0 -113
- package/dist/esm/components/context/DropdownItemSelectionManager.js +0 -174
- package/dist/esm/components/group/DropdownItemGroup.js +0 -43
- package/dist/esm/components/group/DropdownItemGroupCheckbox.js +0 -3
- package/dist/esm/components/group/DropdownItemGroupRadio.js +0 -3
- package/dist/esm/components/group/ert-group-selection.js +0 -1
- package/dist/esm/components/hoc/withItemSelectionManager.js +0 -47
- package/dist/esm/components/hoc/withToggleInteraction.js +0 -155
- package/dist/esm/components/item/DropdownItem.js +0 -3
- package/dist/esm/components/item/DropdownItemCheckbox.js +0 -7
- package/dist/esm/components/item/DropdownItemRadio.js +0 -7
- package/dist/esm/components/item/ert-item-checkbox.js +0 -1
- package/dist/esm/components/item/ert-item-radio.js +0 -1
- package/dist/esm/components/item/ert-item.js +0 -1
- package/dist/esm/styled/WidthConstrainer.js +0 -9
- package/dist/esm/util/contextNamespace.js +0 -8
- package/dist/esm/util/getDisplayName.js +0 -6
- package/dist/esm/util/keys.js +0 -6
- package/dist/esm/util/safeContextCall.js +0 -18
- package/dist/esm/util/supportsVoiceover.js +0 -9
- package/dist/types/components/DropdownMenu.d.ts +0 -36
- package/dist/types/components/DropdownMenuStateless.d.ts +0 -82
- package/dist/types/components/context/DropdownItemClickManager.d.ts +0 -19
- package/dist/types/components/context/DropdownItemFocusManager.d.ts +0 -35
- package/dist/types/components/context/DropdownItemSelectionCache.d.ts +0 -31
- package/dist/types/components/context/DropdownItemSelectionManager.d.ts +0 -34
- package/dist/types/components/group/DropdownItemGroup.d.ts +0 -12
- package/dist/types/components/group/DropdownItemGroupCheckbox.d.ts +0 -55
- package/dist/types/components/group/DropdownItemGroupRadio.d.ts +0 -55
- package/dist/types/components/group/ert-group-selection.d.ts +0 -6
- package/dist/types/components/hoc/withItemSelectionManager.d.ts +0 -63
- package/dist/types/components/hoc/withToggleInteraction.d.ts +0 -98
- package/dist/types/components/item/DropdownItem.d.ts +0 -65
- package/dist/types/components/item/DropdownItemCheckbox.d.ts +0 -80
- package/dist/types/components/item/DropdownItemRadio.d.ts +0 -80
- package/dist/types/components/item/ert-item-checkbox.d.ts +0 -2
- package/dist/types/components/item/ert-item-radio.d.ts +0 -2
- package/dist/types/components/item/ert-item.d.ts +0 -2
- package/dist/types/styled/WidthConstrainer.d.ts +0 -7
- package/dist/types/util/contextNamespace.d.ts +0 -4
- package/dist/types/util/getDisplayName.d.ts +0 -3
- package/dist/types/util/keys.d.ts +0 -6
- package/dist/types/util/safeContextCall.d.ts +0 -6
- package/dist/types/util/supportsVoiceover.d.ts +0 -2
package/dist/types/types.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { KeyboardEvent, MouseEvent, ReactNode } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { KeyboardEvent, MouseEvent, ReactElement, ReactNode, Ref } from 'react';
|
|
2
|
+
import type { 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';
|
|
4
7
|
export declare type ItemId = string;
|
|
5
8
|
export declare type GroupId = string;
|
|
6
9
|
export declare type CachedItem = {
|
|
@@ -12,93 +15,265 @@ export declare type FocusItem = {
|
|
|
12
15
|
itemNode: HTMLElement;
|
|
13
16
|
};
|
|
14
17
|
export declare type Behaviors = 'checkbox' | 'radio' | 'menuitemcheckbox' | 'menuitemradio';
|
|
15
|
-
export interface
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
export interface CustomTriggerProps 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<HTMLElement>;
|
|
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;
|
|
23
45
|
}
|
|
24
|
-
export interface
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
items: Array<DeprecatedItem>;
|
|
46
|
+
export interface MenuWrapperProps extends MenuGroupProps {
|
|
47
|
+
setInitialFocusRef?: ContentProps['setInitialFocusRef'];
|
|
48
|
+
onClose?: ContentProps['onClose'];
|
|
28
49
|
}
|
|
29
|
-
export interface
|
|
30
|
-
event?: Event;
|
|
31
|
-
item: DeprecatedItem;
|
|
50
|
+
export interface DropdownMenuGroupProps extends SectionProps {
|
|
32
51
|
}
|
|
33
|
-
interface
|
|
52
|
+
export interface DropdownMenuProps {
|
|
34
53
|
/**
|
|
35
54
|
* Controls the appearance of the menu.
|
|
36
55
|
* Default menu has scroll after its height exceeds the pre-defined amount.
|
|
37
56
|
* Tall menu has no scroll until the height exceeds the height of the viewport.
|
|
38
57
|
*/
|
|
39
|
-
appearance
|
|
40
|
-
/**
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
*
|
|
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
|
+
*/
|
|
44
70
|
children?: ReactNode;
|
|
45
|
-
/**
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
* to easily get a button trigger.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
A `testId` prop is provided for specified elements, which is a unique
|
|
81
|
-
string that appears as a data attribute `data-testid` in the rendered code,
|
|
82
|
-
serving as a hook for automated tests.
|
|
83
|
-
|
|
84
|
-
As dropdown-menu is composed of different components, we passed down the testId to the sub component you want to test:
|
|
85
|
-
- `testId--trigger` to get the menu trigger.
|
|
86
|
-
- `testId--content` to get the dropdown content trigger.
|
|
87
|
-
*/
|
|
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) => 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
|
+
*/
|
|
88
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;
|
|
89
116
|
}
|
|
90
|
-
export interface
|
|
91
|
-
|
|
92
|
-
|
|
117
|
+
export interface DropdownItemProps {
|
|
118
|
+
/**
|
|
119
|
+
* Primary content for the item.
|
|
120
|
+
*/
|
|
121
|
+
children: React.ReactNode;
|
|
122
|
+
/**
|
|
123
|
+
* Description of the item.
|
|
124
|
+
* This will render smaller text below the primary text of the item as well as slightly increasing the height of the item.
|
|
125
|
+
*/
|
|
126
|
+
description?: string | JSX.Element;
|
|
127
|
+
/**
|
|
128
|
+
* Makes the element appear disabled as well as removing interactivity.
|
|
129
|
+
*/
|
|
130
|
+
isDisabled?: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* When `true` the title of the item will wrap multiple lines if it's long enough.
|
|
133
|
+
*/
|
|
134
|
+
shouldTitleWrap?: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* When `true` the description of the item will wrap multiple lines if it's long enough.
|
|
137
|
+
*/
|
|
138
|
+
shouldDescriptionWrap?: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Event that is triggered when the element is clicked.
|
|
141
|
+
*/
|
|
142
|
+
onClick?: (e: MouseEvent | KeyboardEvent) => void;
|
|
143
|
+
/**
|
|
144
|
+
* Makes the element appear selected.
|
|
145
|
+
*/
|
|
146
|
+
isSelected?: boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Link to another page.
|
|
149
|
+
*/
|
|
150
|
+
href?: string;
|
|
151
|
+
/**
|
|
152
|
+
* Where to display the linked URL,
|
|
153
|
+
* see [anchor information](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a) on mdn for more information.
|
|
154
|
+
*/
|
|
155
|
+
target?: string;
|
|
156
|
+
/**
|
|
157
|
+
* Adds a title attribute to the root item element.
|
|
158
|
+
*/
|
|
159
|
+
title?: string;
|
|
160
|
+
/**
|
|
161
|
+
* Element to render before the item text.
|
|
162
|
+
* Generally should be an [icon](https://atlaskit.atlassian.com/packages/design-system/icon) component.
|
|
163
|
+
*/
|
|
164
|
+
elemBefore?: React.ReactNode;
|
|
165
|
+
/**
|
|
166
|
+
* Element to render after the item text.
|
|
167
|
+
* Generally should be an [icon](https://atlaskit.atlassian.com/packages/design-system/icon) component.
|
|
168
|
+
*/
|
|
169
|
+
elemAfter?: React.ReactNode;
|
|
170
|
+
/**
|
|
171
|
+
* The relationship of the linked URL as space-separated link types.
|
|
172
|
+
* Generally you'll want to set this to "noopener noreferrer" when `target` is "_blank".
|
|
173
|
+
*/
|
|
174
|
+
rel?: string;
|
|
175
|
+
/**
|
|
176
|
+
* A `testId` prop is provided for specified elements,
|
|
177
|
+
* which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
178
|
+
* serving as a hook for automated tests.
|
|
179
|
+
*/
|
|
180
|
+
testId?: string;
|
|
93
181
|
}
|
|
94
|
-
export interface
|
|
95
|
-
/**
|
|
96
|
-
|
|
182
|
+
export interface DropdownItemCheckboxProps {
|
|
183
|
+
/**
|
|
184
|
+
* Primary content for the item.
|
|
185
|
+
*/
|
|
186
|
+
children: React.ReactNode;
|
|
187
|
+
/**
|
|
188
|
+
* Description of the item.
|
|
189
|
+
* This will render smaller text below the primary text of the item as well as slightly increasing the height of the item.
|
|
190
|
+
*/
|
|
191
|
+
description?: string | JSX.Element;
|
|
192
|
+
/**
|
|
193
|
+
* Makes the checkbox appear disabled as well as removing interactivity.
|
|
194
|
+
*/
|
|
195
|
+
isDisabled?: boolean;
|
|
196
|
+
/**
|
|
197
|
+
* When `true` the title of the item will wrap multiple lines if it's long enough.
|
|
198
|
+
*/
|
|
199
|
+
shouldTitleWrap?: boolean;
|
|
200
|
+
/**
|
|
201
|
+
* When `true` the description of the item will wrap multiple lines if it's long enough.
|
|
202
|
+
*/
|
|
203
|
+
shouldDescriptionWrap?: boolean;
|
|
204
|
+
/**
|
|
205
|
+
* Event that is triggered when the checkbox is clicked.
|
|
206
|
+
*/
|
|
207
|
+
onClick?: (e: MouseEvent | KeyboardEvent) => void;
|
|
208
|
+
/**
|
|
209
|
+
* Sets whether the checkbox is checked or unchecked.
|
|
210
|
+
*/
|
|
211
|
+
isSelected?: boolean;
|
|
212
|
+
/**
|
|
213
|
+
* Sets whether the checkbox begins selected.
|
|
214
|
+
*/
|
|
215
|
+
defaultSelected?: boolean;
|
|
216
|
+
/**
|
|
217
|
+
* Unique id of a checkbox
|
|
218
|
+
*/
|
|
219
|
+
id: string;
|
|
220
|
+
/**
|
|
221
|
+
* Adds a title attribute to the root item element.
|
|
222
|
+
*/
|
|
223
|
+
title?: string;
|
|
224
|
+
/**
|
|
225
|
+
* A `testId` prop is provided for specified elements,
|
|
226
|
+
* which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
227
|
+
* serving as a hook for automated tests.
|
|
228
|
+
*/
|
|
229
|
+
testId?: string;
|
|
97
230
|
}
|
|
98
|
-
export interface
|
|
99
|
-
/**
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
231
|
+
export interface DropdownItemRadioProps {
|
|
232
|
+
/**
|
|
233
|
+
* Primary content for the item.
|
|
234
|
+
*/
|
|
235
|
+
children: React.ReactNode;
|
|
236
|
+
/**
|
|
237
|
+
* Description of the item.
|
|
238
|
+
* This will render smaller text below the primary text of the item as well as slightly increasing the height of the item.
|
|
239
|
+
*/
|
|
240
|
+
description?: string | JSX.Element;
|
|
241
|
+
/**
|
|
242
|
+
* Makes the checkbox appear disabled as well as removing interactivity.
|
|
243
|
+
*/
|
|
244
|
+
isDisabled?: boolean;
|
|
245
|
+
/**
|
|
246
|
+
* When `true` the title of the item will wrap multiple lines if it's long enough.
|
|
247
|
+
*/
|
|
248
|
+
shouldTitleWrap?: boolean;
|
|
249
|
+
/**
|
|
250
|
+
* When `true` the description of the item will wrap multiple lines if it's long enough.
|
|
251
|
+
*/
|
|
252
|
+
shouldDescriptionWrap?: boolean;
|
|
253
|
+
/**
|
|
254
|
+
* Event that is triggered when the checkbox is clicked.
|
|
255
|
+
*/
|
|
256
|
+
onClick?: (e: MouseEvent | KeyboardEvent) => void;
|
|
257
|
+
/**
|
|
258
|
+
* Sets whether the checkbox is checked or unchecked.
|
|
259
|
+
*/
|
|
260
|
+
isSelected?: boolean;
|
|
261
|
+
/**
|
|
262
|
+
* Sets whether the checkbox begins selected.
|
|
263
|
+
*/
|
|
264
|
+
defaultSelected?: boolean;
|
|
265
|
+
/**
|
|
266
|
+
* Unique id of a checkbox
|
|
267
|
+
*/
|
|
268
|
+
id: string;
|
|
269
|
+
/**
|
|
270
|
+
* Adds a title attribute to the root item element.
|
|
271
|
+
*/
|
|
272
|
+
title?: string;
|
|
273
|
+
/**
|
|
274
|
+
* A `testId` prop is provided for specified elements,
|
|
275
|
+
* which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
276
|
+
* serving as a hook for automated tests.
|
|
277
|
+
*/
|
|
278
|
+
testId?: string;
|
|
103
279
|
}
|
|
104
|
-
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/dropdown-menu",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.2",
|
|
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/"
|
|
@@ -13,49 +13,50 @@
|
|
|
13
13
|
"module:es2019": "dist/es2019/index.js",
|
|
14
14
|
"types": "dist/types/index.d.ts",
|
|
15
15
|
"sideEffects": false,
|
|
16
|
-
"atlaskit:src": "src/index.
|
|
16
|
+
"atlaskit:src": "src/index.tsx",
|
|
17
17
|
"atlassian": {
|
|
18
18
|
"team": "Design System Team",
|
|
19
|
-
"inPublicMirror": true,
|
|
20
19
|
"releaseModel": "scheduled",
|
|
21
20
|
"website": {
|
|
22
21
|
"name": "Dropdown menu"
|
|
23
22
|
}
|
|
24
23
|
},
|
|
25
|
-
"af:exports": {
|
|
26
|
-
".": "./src/index.ts",
|
|
27
|
-
"./types": "./src/types.tsx"
|
|
28
|
-
},
|
|
29
24
|
"dependencies": {
|
|
30
|
-
"@atlaskit/
|
|
31
|
-
"@atlaskit/
|
|
32
|
-
"@atlaskit/
|
|
33
|
-
"@atlaskit/icon": "^21.
|
|
34
|
-
"@atlaskit/
|
|
35
|
-
"@atlaskit/
|
|
25
|
+
"@atlaskit/button": "^16.1.0",
|
|
26
|
+
"@atlaskit/codemod-utils": "^3.2.0",
|
|
27
|
+
"@atlaskit/ds-lib": "^1.1.0",
|
|
28
|
+
"@atlaskit/icon": "^21.10.0",
|
|
29
|
+
"@atlaskit/menu": "^1.0.0",
|
|
30
|
+
"@atlaskit/popup": "^1.3.0",
|
|
31
|
+
"@atlaskit/spinner": "^15.0.0",
|
|
32
|
+
"@atlaskit/theme": "^12.1.0",
|
|
33
|
+
"@atlaskit/tokens": "^0.5.0",
|
|
34
|
+
"@atlaskit/visually-hidden": "^0.1.1",
|
|
36
35
|
"@babel/runtime": "^7.0.0",
|
|
37
|
-
"
|
|
38
|
-
"prop-types": "^15.5.10"
|
|
36
|
+
"@emotion/core": "^10.0.9"
|
|
39
37
|
},
|
|
40
38
|
"peerDependencies": {
|
|
41
39
|
"react": "^16.8.0",
|
|
42
|
-
"react-dom": "^16.8.0"
|
|
43
|
-
"styled-components": "^3.2.6"
|
|
40
|
+
"react-dom": "^16.8.0"
|
|
44
41
|
},
|
|
45
42
|
"devDependencies": {
|
|
46
|
-
"@atlaskit/avatar": "^20.
|
|
47
|
-
"@atlaskit/build-utils": "*",
|
|
43
|
+
"@atlaskit/avatar": "^20.5.0",
|
|
48
44
|
"@atlaskit/docs": "*",
|
|
49
|
-
"@atlaskit/lozenge": "11.
|
|
50
|
-
"@atlaskit/modal-dialog": "^
|
|
45
|
+
"@atlaskit/lozenge": "11.1.5",
|
|
46
|
+
"@atlaskit/modal-dialog": "^12.2.0",
|
|
47
|
+
"@atlaskit/section-message": "^6.1.0",
|
|
51
48
|
"@atlaskit/ssr": "*",
|
|
52
|
-
"@atlaskit/tooltip": "^17.
|
|
49
|
+
"@atlaskit/tooltip": "^17.5.0",
|
|
53
50
|
"@atlaskit/visual-regression": "*",
|
|
54
51
|
"@atlaskit/webdriver-runner": "*",
|
|
55
52
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
53
|
+
"@testing-library/dom": "^7.7.3",
|
|
56
54
|
"@testing-library/react": "^8.0.1",
|
|
57
|
-
"
|
|
55
|
+
"@testing-library/react-hooks": "^1.0.4",
|
|
56
|
+
"jscodeshift": "^0.13.0",
|
|
58
57
|
"react-dom": "^16.8.0",
|
|
58
|
+
"storybook-addon-performance": "^0.16.0",
|
|
59
|
+
"tiny-invariant": "^0.0.3",
|
|
59
60
|
"typescript": "3.9.6"
|
|
60
61
|
},
|
|
61
62
|
"keywords": [
|
|
@@ -66,8 +67,23 @@
|
|
|
66
67
|
"techstack": {
|
|
67
68
|
"@atlassian/frontend": {
|
|
68
69
|
"import-structure": "atlassian-conventions"
|
|
70
|
+
},
|
|
71
|
+
"@repo/internal": {
|
|
72
|
+
"ui-components": "lite-mode",
|
|
73
|
+
"design-system": "v1",
|
|
74
|
+
"styling": [
|
|
75
|
+
"static",
|
|
76
|
+
"emotion"
|
|
77
|
+
],
|
|
78
|
+
"analytics": "analytics-next",
|
|
79
|
+
"deprecation": "no-deprecated-imports",
|
|
80
|
+
"theming": "tokens"
|
|
69
81
|
}
|
|
70
82
|
},
|
|
83
|
+
"af:exports": {
|
|
84
|
+
".": "./src/index.tsx",
|
|
85
|
+
"./types": "./src/types.tsx"
|
|
86
|
+
},
|
|
71
87
|
"homepage": "https://atlassian.design/components/dropdown-menu/",
|
|
72
88
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
|
|
73
89
|
}
|