@atlaskit/dropdown-menu 11.5.0 → 11.5.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 +12 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types-ts4.0/checkbox/dropdown-item-checkbox-group.d.ts +16 -0
- package/dist/types-ts4.0/checkbox/dropdown-item-checkbox.d.ts +13 -0
- package/dist/types-ts4.0/dropdown-menu-item-group.d.ts +11 -0
- package/dist/types-ts4.0/dropdown-menu-item.d.ts +13 -0
- package/dist/types-ts4.0/dropdown-menu.d.ts +13 -0
- package/dist/types-ts4.0/index.d.ts +8 -0
- package/dist/types-ts4.0/internal/components/focus-manager.d.ts +19 -0
- package/dist/types-ts4.0/internal/components/menu-wrapper.d.ts +11 -0
- package/dist/types-ts4.0/internal/context/checkbox-group-context.d.ts +5 -0
- package/dist/types-ts4.0/internal/context/selection-store.d.ts +27 -0
- package/dist/types-ts4.0/internal/hooks/use-checkbox-state.d.ts +17 -0
- package/dist/types-ts4.0/internal/hooks/use-radio-state.d.ts +12 -0
- package/dist/types-ts4.0/internal/hooks/use-register-item-with-focus-manager.d.ts +4 -0
- package/dist/types-ts4.0/internal/utils/get-icon-colors.d.ts +8 -0
- package/dist/types-ts4.0/internal/utils/handle-focus.d.ts +2 -0
- package/dist/types-ts4.0/internal/utils/is-checkbox-item.d.ts +1 -0
- package/dist/types-ts4.0/internal/utils/is-radio-item.d.ts +1 -0
- package/dist/types-ts4.0/internal/utils/is-voice-over-supported.d.ts +2 -0
- package/dist/types-ts4.0/internal/utils/reset-options-in-group.d.ts +4 -0
- package/dist/types-ts4.0/internal/utils/use-generated-id.d.ts +5 -0
- package/dist/types-ts4.0/radio/dropdown-item-radio-group.d.ts +25 -0
- package/dist/types-ts4.0/radio/dropdown-item-radio.d.ts +13 -0
- package/dist/types-ts4.0/types.d.ts +289 -0
- package/package.json +22 -12
- package/report.api.md +7 -4
- package/types/package.json +8 -1
- package/dist/cjs/visual-regression/index.js +0 -93
- package/dist/es2019/visual-regression/index.js +0 -30
- package/dist/esm/visual-regression/index.js +0 -86
- package/dist/types/visual-regression/index.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/dropdown-menu
|
|
2
2
|
|
|
3
|
+
## 11.5.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`bc989043572`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bc989043572) - Internal changes to apply spacing tokens. This should be a no-op change.
|
|
8
|
+
|
|
9
|
+
## 11.5.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`8cc2f888c83`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cc2f888c83) - Upgrade Typescript from `4.3.5` to `4.5.5`
|
|
14
|
+
|
|
3
15
|
## 11.5.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/version.json
CHANGED
package/dist/esm/version.json
CHANGED
|
@@ -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,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,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 @@
|
|
|
1
|
+
export default function isCheckboxItem(element: HTMLElement): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function isCheckboxItem(element: HTMLElement): boolean;
|
|
@@ -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
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/dropdown-menu",
|
|
3
|
-
"version": "11.5.
|
|
3
|
+
"version": "11.5.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/"
|
|
@@ -12,9 +12,18 @@
|
|
|
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
|
+
"dist/types-ts4.0/index.d.ts"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
},
|
|
15
23
|
"sideEffects": false,
|
|
16
24
|
"atlaskit:src": "src/index.tsx",
|
|
17
25
|
"atlassian": {
|
|
26
|
+
"disableProductCI": true,
|
|
18
27
|
"team": "Design System Team",
|
|
19
28
|
"releaseModel": "scheduled",
|
|
20
29
|
"website": {
|
|
@@ -26,9 +35,9 @@
|
|
|
26
35
|
"@atlaskit/button": "^16.3.0",
|
|
27
36
|
"@atlaskit/codemod-utils": "^4.1.0",
|
|
28
37
|
"@atlaskit/ds-lib": "^2.1.0",
|
|
29
|
-
"@atlaskit/icon": "^21.
|
|
38
|
+
"@atlaskit/icon": "^21.11.0",
|
|
30
39
|
"@atlaskit/menu": "^1.3.0",
|
|
31
|
-
"@atlaskit/popup": "^1.
|
|
40
|
+
"@atlaskit/popup": "^1.5.0",
|
|
32
41
|
"@atlaskit/spinner": "^15.0.0",
|
|
33
42
|
"@atlaskit/theme": "^12.2.0",
|
|
34
43
|
"@atlaskit/tokens": "^0.10.0",
|
|
@@ -42,25 +51,25 @@
|
|
|
42
51
|
"react-dom": "^16.8.0"
|
|
43
52
|
},
|
|
44
53
|
"devDependencies": {
|
|
45
|
-
"@atlaskit/avatar": "^21.
|
|
54
|
+
"@atlaskit/avatar": "^21.1.0",
|
|
46
55
|
"@atlaskit/docs": "*",
|
|
47
|
-
"@atlaskit/lozenge": "11.2.
|
|
48
|
-
"@atlaskit/modal-dialog": "^12.
|
|
49
|
-
"@atlaskit/section-message": "^6.
|
|
56
|
+
"@atlaskit/lozenge": "11.2.5",
|
|
57
|
+
"@atlaskit/modal-dialog": "^12.4.0",
|
|
58
|
+
"@atlaskit/section-message": "^6.3.0",
|
|
50
59
|
"@atlaskit/ssr": "*",
|
|
51
|
-
"@atlaskit/tooltip": "^17.
|
|
60
|
+
"@atlaskit/tooltip": "^17.6.0",
|
|
52
61
|
"@atlaskit/visual-regression": "*",
|
|
53
62
|
"@atlaskit/webdriver-runner": "*",
|
|
54
63
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
55
|
-
"@testing-library/dom": "^
|
|
56
|
-
"@testing-library/react": "^
|
|
57
|
-
"@testing-library/react-hooks": "^
|
|
64
|
+
"@testing-library/dom": "^8.17.1",
|
|
65
|
+
"@testing-library/react": "^12.1.5",
|
|
66
|
+
"@testing-library/react-hooks": "^8.0.1",
|
|
58
67
|
"jscodeshift": "^0.13.0",
|
|
59
68
|
"raf-stub": "^2.0.1",
|
|
60
69
|
"react-dom": "^16.8.0",
|
|
61
70
|
"storybook-addon-performance": "^0.16.0",
|
|
62
71
|
"tiny-invariant": "^1.2.0",
|
|
63
|
-
"typescript": "4.
|
|
72
|
+
"typescript": "4.5.5"
|
|
64
73
|
},
|
|
65
74
|
"keywords": [
|
|
66
75
|
"atlaskit",
|
|
@@ -75,6 +84,7 @@
|
|
|
75
84
|
"dom-events": "use-bind-event-listener",
|
|
76
85
|
"ui-components": "lite-mode",
|
|
77
86
|
"design-system": "v1",
|
|
87
|
+
"design-tokens": "spacing",
|
|
78
88
|
"styling": [
|
|
79
89
|
"static",
|
|
80
90
|
"emotion"
|
package/report.api.md
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
## API Report File for "@atlaskit/dropdown-menu"
|
|
1
|
+
## API Report File for "@atlaskit/dropdown-menu".
|
|
2
2
|
|
|
3
|
-
> Do not edit this file.
|
|
3
|
+
> Do not edit this file. This report is auto-generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
[Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
4
6
|
|
|
5
7
|
```ts
|
|
6
8
|
/// <reference types="react" />
|
|
7
9
|
|
|
8
10
|
import type { CustomItemProps } from '@atlaskit/menu/types';
|
|
9
11
|
import { default as DropdownItemGroup } from '@atlaskit/menu/section';
|
|
12
|
+
import { jsx } from '@emotion/react';
|
|
10
13
|
import { KeyboardEvent as KeyboardEvent_2 } from 'react';
|
|
11
14
|
import { MouseEvent as MouseEvent_2 } from 'react';
|
|
12
15
|
import { ReactElement } from 'react';
|
|
@@ -290,7 +293,7 @@ declare interface DropdownItemRadioProps {
|
|
|
290
293
|
* - [Code](https://atlassian.design/components/dropdown-menu/code)
|
|
291
294
|
* - [Usage](https://atlassian.design/components/dropdown-menu/usage)
|
|
292
295
|
*/
|
|
293
|
-
declare const DropdownMenu: (props: DropdownMenuProps) => JSX.Element;
|
|
296
|
+
declare const DropdownMenu: (props: DropdownMenuProps) => jsx.JSX.Element;
|
|
294
297
|
export default DropdownMenu;
|
|
295
298
|
|
|
296
299
|
export declare interface DropdownMenuGroupProps extends SectionProps_2 {}
|
|
@@ -369,7 +372,7 @@ export declare interface DropdownMenuProps {
|
|
|
369
372
|
|
|
370
373
|
export declare interface OnOpenChangeArgs {
|
|
371
374
|
isOpen: boolean;
|
|
372
|
-
event
|
|
375
|
+
event: MouseEvent_2 | KeyboardEvent_2;
|
|
373
376
|
}
|
|
374
377
|
|
|
375
378
|
declare type Placement =
|
package/types/package.json
CHANGED
|
@@ -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
|
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
6
|
-
|
|
7
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
8
|
-
|
|
9
|
-
var _helper = require("@atlaskit/visual-regression/helper");
|
|
10
|
-
|
|
11
|
-
var dropdownTrigger = '[data-testid="dropdown--trigger"]';
|
|
12
|
-
var dropdownContent = '[data-testid="dropdown--content"]';
|
|
13
|
-
describe('Snapshot Test', function () {
|
|
14
|
-
it('it should match visual snapshot for dropdown', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
15
|
-
var url, _global, page, dropdownImage;
|
|
16
|
-
|
|
17
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
18
|
-
while (1) {
|
|
19
|
-
switch (_context.prev = _context.next) {
|
|
20
|
-
case 0:
|
|
21
|
-
url = (0, _helper.getExampleUrl)('design-system', 'dropdown-menu', 'default-dropdown-menu', global.__BASEURL__);
|
|
22
|
-
_global = global, page = _global.page;
|
|
23
|
-
_context.next = 4;
|
|
24
|
-
return (0, _helper.loadPage)(page, url);
|
|
25
|
-
|
|
26
|
-
case 4:
|
|
27
|
-
_context.next = 6;
|
|
28
|
-
return page.waitForSelector(dropdownContent);
|
|
29
|
-
|
|
30
|
-
case 6:
|
|
31
|
-
_context.next = 8;
|
|
32
|
-
return page.screenshot();
|
|
33
|
-
|
|
34
|
-
case 8:
|
|
35
|
-
dropdownImage = _context.sent;
|
|
36
|
-
expect(dropdownImage).toMatchProdImageSnapshot();
|
|
37
|
-
|
|
38
|
-
case 10:
|
|
39
|
-
case "end":
|
|
40
|
-
return _context.stop();
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}, _callee);
|
|
44
|
-
})));
|
|
45
|
-
it('should accept custom zIndex', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
46
|
-
var url, _global2, page, button, popupImage;
|
|
47
|
-
|
|
48
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
49
|
-
while (1) {
|
|
50
|
-
switch (_context2.prev = _context2.next) {
|
|
51
|
-
case 0:
|
|
52
|
-
url = (0, _helper.getExampleUrl)('design-system', 'dropdown-menu', 'setting-z-index', global.__BASEURL__);
|
|
53
|
-
_global2 = global, page = _global2.page;
|
|
54
|
-
button = "[data-testid='popup--trigger']";
|
|
55
|
-
_context2.next = 5;
|
|
56
|
-
return (0, _helper.loadPage)(page, url);
|
|
57
|
-
|
|
58
|
-
case 5:
|
|
59
|
-
_context2.next = 7;
|
|
60
|
-
return page.waitForSelector(button);
|
|
61
|
-
|
|
62
|
-
case 7:
|
|
63
|
-
_context2.next = 9;
|
|
64
|
-
return page.click(button);
|
|
65
|
-
|
|
66
|
-
case 9:
|
|
67
|
-
_context2.next = 11;
|
|
68
|
-
return page.waitForSelector(dropdownTrigger);
|
|
69
|
-
|
|
70
|
-
case 11:
|
|
71
|
-
_context2.next = 13;
|
|
72
|
-
return page.click(dropdownTrigger);
|
|
73
|
-
|
|
74
|
-
case 13:
|
|
75
|
-
_context2.next = 15;
|
|
76
|
-
return page.waitForSelector(dropdownContent);
|
|
77
|
-
|
|
78
|
-
case 15:
|
|
79
|
-
_context2.next = 17;
|
|
80
|
-
return page.screenshot();
|
|
81
|
-
|
|
82
|
-
case 17:
|
|
83
|
-
popupImage = _context2.sent;
|
|
84
|
-
expect(popupImage).toMatchProdImageSnapshot();
|
|
85
|
-
|
|
86
|
-
case 19:
|
|
87
|
-
case "end":
|
|
88
|
-
return _context2.stop();
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}, _callee2);
|
|
92
|
-
})));
|
|
93
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { getExampleUrl, loadPage } from '@atlaskit/visual-regression/helper';
|
|
2
|
-
const dropdownTrigger = '[data-testid="dropdown--trigger"]';
|
|
3
|
-
const dropdownContent = '[data-testid="dropdown--content"]';
|
|
4
|
-
describe('Snapshot Test', () => {
|
|
5
|
-
it('it should match visual snapshot for dropdown', async () => {
|
|
6
|
-
const url = getExampleUrl('design-system', 'dropdown-menu', 'default-dropdown-menu', global.__BASEURL__);
|
|
7
|
-
const {
|
|
8
|
-
page
|
|
9
|
-
} = global;
|
|
10
|
-
await loadPage(page, url);
|
|
11
|
-
await page.waitForSelector(dropdownContent);
|
|
12
|
-
const dropdownImage = await page.screenshot();
|
|
13
|
-
expect(dropdownImage).toMatchProdImageSnapshot();
|
|
14
|
-
});
|
|
15
|
-
it('should accept custom zIndex', async () => {
|
|
16
|
-
const url = getExampleUrl('design-system', 'dropdown-menu', 'setting-z-index', global.__BASEURL__);
|
|
17
|
-
const {
|
|
18
|
-
page
|
|
19
|
-
} = global;
|
|
20
|
-
const button = "[data-testid='popup--trigger']";
|
|
21
|
-
await loadPage(page, url);
|
|
22
|
-
await page.waitForSelector(button);
|
|
23
|
-
await page.click(button);
|
|
24
|
-
await page.waitForSelector(dropdownTrigger);
|
|
25
|
-
await page.click(dropdownTrigger);
|
|
26
|
-
await page.waitForSelector(dropdownContent);
|
|
27
|
-
const popupImage = await page.screenshot();
|
|
28
|
-
expect(popupImage).toMatchProdImageSnapshot();
|
|
29
|
-
});
|
|
30
|
-
});
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
-
import { getExampleUrl, loadPage } from '@atlaskit/visual-regression/helper';
|
|
4
|
-
var dropdownTrigger = '[data-testid="dropdown--trigger"]';
|
|
5
|
-
var dropdownContent = '[data-testid="dropdown--content"]';
|
|
6
|
-
describe('Snapshot Test', function () {
|
|
7
|
-
it('it should match visual snapshot for dropdown', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
8
|
-
var url, _global, page, dropdownImage;
|
|
9
|
-
|
|
10
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
11
|
-
while (1) {
|
|
12
|
-
switch (_context.prev = _context.next) {
|
|
13
|
-
case 0:
|
|
14
|
-
url = getExampleUrl('design-system', 'dropdown-menu', 'default-dropdown-menu', global.__BASEURL__);
|
|
15
|
-
_global = global, page = _global.page;
|
|
16
|
-
_context.next = 4;
|
|
17
|
-
return loadPage(page, url);
|
|
18
|
-
|
|
19
|
-
case 4:
|
|
20
|
-
_context.next = 6;
|
|
21
|
-
return page.waitForSelector(dropdownContent);
|
|
22
|
-
|
|
23
|
-
case 6:
|
|
24
|
-
_context.next = 8;
|
|
25
|
-
return page.screenshot();
|
|
26
|
-
|
|
27
|
-
case 8:
|
|
28
|
-
dropdownImage = _context.sent;
|
|
29
|
-
expect(dropdownImage).toMatchProdImageSnapshot();
|
|
30
|
-
|
|
31
|
-
case 10:
|
|
32
|
-
case "end":
|
|
33
|
-
return _context.stop();
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}, _callee);
|
|
37
|
-
})));
|
|
38
|
-
it('should accept custom zIndex', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
39
|
-
var url, _global2, page, button, popupImage;
|
|
40
|
-
|
|
41
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
42
|
-
while (1) {
|
|
43
|
-
switch (_context2.prev = _context2.next) {
|
|
44
|
-
case 0:
|
|
45
|
-
url = getExampleUrl('design-system', 'dropdown-menu', 'setting-z-index', global.__BASEURL__);
|
|
46
|
-
_global2 = global, page = _global2.page;
|
|
47
|
-
button = "[data-testid='popup--trigger']";
|
|
48
|
-
_context2.next = 5;
|
|
49
|
-
return loadPage(page, url);
|
|
50
|
-
|
|
51
|
-
case 5:
|
|
52
|
-
_context2.next = 7;
|
|
53
|
-
return page.waitForSelector(button);
|
|
54
|
-
|
|
55
|
-
case 7:
|
|
56
|
-
_context2.next = 9;
|
|
57
|
-
return page.click(button);
|
|
58
|
-
|
|
59
|
-
case 9:
|
|
60
|
-
_context2.next = 11;
|
|
61
|
-
return page.waitForSelector(dropdownTrigger);
|
|
62
|
-
|
|
63
|
-
case 11:
|
|
64
|
-
_context2.next = 13;
|
|
65
|
-
return page.click(dropdownTrigger);
|
|
66
|
-
|
|
67
|
-
case 13:
|
|
68
|
-
_context2.next = 15;
|
|
69
|
-
return page.waitForSelector(dropdownContent);
|
|
70
|
-
|
|
71
|
-
case 15:
|
|
72
|
-
_context2.next = 17;
|
|
73
|
-
return page.screenshot();
|
|
74
|
-
|
|
75
|
-
case 17:
|
|
76
|
-
popupImage = _context2.sent;
|
|
77
|
-
expect(popupImage).toMatchProdImageSnapshot();
|
|
78
|
-
|
|
79
|
-
case 19:
|
|
80
|
-
case "end":
|
|
81
|
-
return _context2.stop();
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}, _callee2);
|
|
85
|
-
})));
|
|
86
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|