@atlaskit/dropdown-menu 16.10.4 → 16.10.6

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 (41) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dropdown-item-checkbox/package.json +1 -8
  3. package/dropdown-item-checkbox-group/package.json +1 -8
  4. package/dropdown-item-radio/package.json +1 -8
  5. package/dropdown-item-radio-group/package.json +1 -8
  6. package/dropdown-menu/package.json +1 -8
  7. package/dropdown-menu-item/package.json +1 -8
  8. package/dropdown-menu-item-group/package.json +1 -8
  9. package/package.json +6 -6
  10. package/types/package.json +1 -8
  11. package/dist/types-ts4.5/checkbox/dropdown-item-checkbox-group.d.ts +0 -16
  12. package/dist/types-ts4.5/checkbox/dropdown-item-checkbox.d.ts +0 -13
  13. package/dist/types-ts4.5/dropdown-menu-item-group.d.ts +0 -10
  14. package/dist/types-ts4.5/dropdown-menu-item.d.ts +0 -13
  15. package/dist/types-ts4.5/dropdown-menu-top-layer.d.ts +0 -18
  16. package/dist/types-ts4.5/dropdown-menu.d.ts +0 -13
  17. package/dist/types-ts4.5/index.d.ts +0 -8
  18. package/dist/types-ts4.5/internal/components/checkbox-icon.d.ts +0 -17
  19. package/dist/types-ts4.5/internal/components/focus-manager-context.d.ts +0 -12
  20. package/dist/types-ts4.5/internal/components/focus-manager.d.ts +0 -9
  21. package/dist/types-ts4.5/internal/components/group-title.d.ts +0 -18
  22. package/dist/types-ts4.5/internal/components/menu-wrapper.d.ts +0 -10
  23. package/dist/types-ts4.5/internal/components/radio-icon.d.ts +0 -17
  24. package/dist/types-ts4.5/internal/context/checkbox-group-context.d.ts +0 -4
  25. package/dist/types-ts4.5/internal/context/selection-store-context.d.ts +0 -16
  26. package/dist/types-ts4.5/internal/context/selection-store.d.ts +0 -11
  27. package/dist/types-ts4.5/internal/hooks/use-checkbox-state.d.ts +0 -17
  28. package/dist/types-ts4.5/internal/hooks/use-radio-state.d.ts +0 -12
  29. package/dist/types-ts4.5/internal/hooks/use-register-item-with-focus-manager.d.ts +0 -3
  30. package/dist/types-ts4.5/internal/use-arrow-navigation/index.d.ts +0 -2
  31. package/dist/types-ts4.5/internal/use-arrow-navigation/use-arrow-navigation.d.ts +0 -1
  32. package/dist/types-ts4.5/internal/utils/handle-focus.d.ts +0 -3
  33. package/dist/types-ts4.5/internal/utils/is-checkbox-item.d.ts +0 -1
  34. package/dist/types-ts4.5/internal/utils/is-radio-item.d.ts +0 -1
  35. package/dist/types-ts4.5/internal/utils/is-voice-over-supported.d.ts +0 -2
  36. package/dist/types-ts4.5/internal/utils/reset-options-in-group.d.ts +0 -4
  37. package/dist/types-ts4.5/internal/utils/use-generated-id.d.ts +0 -6
  38. package/dist/types-ts4.5/radio/dropdown-item-radio-group.d.ts +0 -13
  39. package/dist/types-ts4.5/radio/dropdown-item-radio.d.ts +0 -13
  40. package/dist/types-ts4.5/radio/radio-group-context.d.ts +0 -14
  41. package/dist/types-ts4.5/types.d.ts +0 -435
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/dropdown-menu
2
2
 
3
+ ## 16.10.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 16.10.5
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 16.10.4
4
16
 
5
17
  ### Patch Changes
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "**/*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/checkbox/dropdown-item-checkbox.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/checkbox/dropdown-item-checkbox.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/checkbox/dropdown-item-checkbox.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "**/*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/checkbox/dropdown-item-checkbox-group.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/checkbox/dropdown-item-checkbox-group.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/checkbox/dropdown-item-checkbox-group.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "**/*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/radio/dropdown-item-radio.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/radio/dropdown-item-radio.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/radio/dropdown-item-radio.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "**/*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/radio/dropdown-item-radio-group.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/radio/dropdown-item-radio-group.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/radio/dropdown-item-radio-group.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "**/*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/dropdown-menu.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/dropdown-menu.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/dropdown-menu.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "**/*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/dropdown-menu-item.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/dropdown-menu-item.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/dropdown-menu-item.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "**/*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/dropdown-menu-item-group.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/dropdown-menu-item-group.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/dropdown-menu-item-group.d.ts"
17
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/dropdown-menu",
3
- "version": "16.10.4",
3
+ "version": "16.10.6",
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/"
@@ -38,12 +38,12 @@
38
38
  "@atlaskit/layering": "^3.8.0",
39
39
  "@atlaskit/menu": "^8.5.0",
40
40
  "@atlaskit/platform-feature-flags": "^1.1.0",
41
- "@atlaskit/popup": "^4.23.0",
41
+ "@atlaskit/popup": "^4.25.0",
42
42
  "@atlaskit/primitives": "^19.0.0",
43
43
  "@atlaskit/spinner": "^19.1.0",
44
44
  "@atlaskit/theme": "^25.0.0",
45
- "@atlaskit/tokens": "^13.3.0",
46
- "@atlaskit/top-layer": "^0.16.0",
45
+ "@atlaskit/tokens": "^13.4.0",
46
+ "@atlaskit/top-layer": "^0.18.0",
47
47
  "@atlaskit/visually-hidden": "^3.1.0",
48
48
  "@babel/runtime": "^7.0.0",
49
49
  "@compiled/react": "^0.20.0",
@@ -65,8 +65,8 @@
65
65
  "@atlaskit/form": "^15.5.0",
66
66
  "@atlaskit/heading": "^5.4.0",
67
67
  "@atlaskit/link": "^3.4.0",
68
- "@atlaskit/lozenge": "^13.8.0",
69
- "@atlaskit/modal-dialog": "^15.2.0",
68
+ "@atlaskit/lozenge": "^13.9.0",
69
+ "@atlaskit/modal-dialog": "^15.3.0",
70
70
  "@atlaskit/section-message": "^8.13.0",
71
71
  "@atlaskit/textfield": "^8.3.0",
72
72
  "@atlaskit/toggle": "^16.1.0",
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "**/*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/types.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/types.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/types.d.ts"
17
10
  }
@@ -1,16 +0,0 @@
1
- import React from '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: ({ children, hasSeparator, id, isList, isScrollable, testId, title, ...rest }: DropdownItemCheckboxGroupProps) => React.JSX.Element;
16
- export default DropdownItemCheckboxGroup;
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import { type 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: ({ children, defaultSelected, description, id, isDisabled, isSelected, onClick: providedOnClick, shouldDescriptionWrap, shouldTitleWrap, testId, interactionName, ...rest }: DropdownItemCheckboxProps) => React.JSX.Element;
13
- export default DropdownItemCheckbox;
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import { type SectionProps } from '@atlaskit/menu';
3
- /**
4
- * __Dropdown item checkbox group__
5
- *
6
- * A wrapping element for dropdown menu items.
7
- *
8
- */
9
- declare const DropdownMenuItemGroup: React.ForwardRefExoticComponent<React.PropsWithoutRef<SectionProps> & React.RefAttributes<HTMLElement>>;
10
- export default DropdownMenuItemGroup;
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import { type 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-menu/dropdown-item/examples)
9
- * - [Code](https://atlassian.design/components/dropdown-menu/dropdown-item/code)
10
- * - [Usage](https://atlassian.design/components/dropdown-menu/dropdown-item/usage)
11
- */
12
- declare const DropdownMenuItem: React.ForwardRefExoticComponent<React.PropsWithoutRef<DropdownItemProps> & React.RefAttributes<HTMLElement>>;
13
- export default DropdownMenuItem;
@@ -1,18 +0,0 @@
1
- import type { DropdownMenuProps } from './types';
2
- /**
3
- * Top-layer implementation of DropdownMenu.
4
- *
5
- * Replaces the legacy `@atlaskit/popup` + `@atlaskit/portal` + `@atlaskit/layering` pipeline
6
- * with the native Popover API via `@atlaskit/top-layer`.
7
- *
8
- * What is no longer needed:
9
- * - Portal: top layer handles stacking natively
10
- * - FocusLock / react-focus-lock: popover=auto provides light dismiss
11
- * - z-index: top layer is always above everything
12
- * - FocusManager (ref registration): replaced by DOM-query-based `useArrowNavigation`
13
- * - handle-focus.tsx: replaced by `useArrowNavigation`
14
- * - Layering context: top layer nesting is handled by the browser
15
- * - Fallback placements / Popper: CSS Anchor Positioning handles positioning
16
- */
17
- declare function DropdownMenuTopLayer({ autoFocus, children, defaultOpen, isLoading, isOpen: isOpenProp, onOpenChange, placement, shouldFitContainer, returnFocusRef, spacing, statusLabel, testId, trigger, label, interactionName, menuLabel, }: DropdownMenuProps): React.JSX.Element;
18
- export default DropdownMenuTopLayer;
@@ -1,13 +0,0 @@
1
- import React from '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 = any>(props: DropdownMenuProps<T>) => React.JSX.Element;
13
- export default DropdownMenu;
@@ -1,8 +0,0 @@
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';
@@ -1,17 +0,0 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- * @jsxFrag jsx
5
- */
6
- import React from 'react';
7
- /**
8
- * __Checkbox icon__
9
- *
10
- * Used to visually represent the selected state in DropdownItemCheckbox
11
- *
12
- * @internal
13
- */
14
- declare const CheckboxIcon: ({ checked }: {
15
- checked: boolean;
16
- }) => React.JSX.Element;
17
- export default CheckboxIcon;
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import { type FocusableElementRef } from '../../types';
3
- /**
4
- * __Focus manager context__
5
- *
6
- * A context that stores dropdown menu item refs and provides a way to register
7
- * them for focus management within the dropdown menu.
8
- */
9
- export declare const FocusManagerContext: React.Context<{
10
- menuItemRefs: FocusableElementRef[];
11
- registerRef(ref: FocusableElementRef): void;
12
- }>;
@@ -1,9 +0,0 @@
1
- import { type FC, type ReactNode } from 'react';
2
- /**
3
- * Focus manager logic.
4
- */
5
- declare const FocusManager: FC<{
6
- children: ReactNode;
7
- onClose: (e: KeyboardEvent) => void;
8
- }>;
9
- export default FocusManager;
@@ -1,18 +0,0 @@
1
- import React from 'react';
2
- /**
3
- * __Group title__
4
- *
5
- * Used to visually represent the title for DropdownMenu groups.
6
- *
7
- * Pre-existing a11y note: uses `role="menuitem"` with `aria-hidden="true"`.
8
- * WAI-ARIA APG recommends `role="presentation"` for non-interactive group
9
- * headings, with the group linked via `aria-labelledby`. Out of scope for
10
- * the top-layer migration — this is legacy behavior.
11
- *
12
- * @internal
13
- */
14
- declare const GroupTitle: ({ id, title }: {
15
- id: string;
16
- title: string;
17
- }) => React.JSX.Element;
18
- export default GroupTitle;
@@ -1,10 +0,0 @@
1
- import { type MenuWrapperProps } from '../../types';
2
- /**
3
- *
4
- * MenuWrapper wraps all the menu items.
5
- * It handles the logic to close the menu when a MenuItem is clicked, but leaves it open
6
- * if a CheckboxItem or RadioItem is clicked.
7
- * It also sets focus to the first menu item when opened.
8
- */
9
- declare const MenuWrapper: ({ children, isLoading, maxHeight, maxWidth, onClose, onUpdate, statusLabel, setInitialFocusRef, shouldRenderToParent, spacing, testId, isTriggeredUsingKeyboard, autoFocus, menuLabel, }: MenuWrapperProps) => JSX.Element;
10
- export default MenuWrapper;
@@ -1,17 +0,0 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- * @jsxFrag jsx
5
- */
6
- import React from 'react';
7
- /**
8
- * __Radio icon__
9
- *
10
- * Used to visually represent the selected state in DropdownItemRadio
11
- *
12
- * @internal
13
- */
14
- declare const RadioIcon: ({ checked }: {
15
- checked: boolean;
16
- }) => React.JSX.Element;
17
- export default RadioIcon;
@@ -1,4 +0,0 @@
1
- /**
2
- * Holds the unique identifier for the checkbox group.
3
- */
4
- export declare const CheckboxGroupContext: import('react').Context<string>;
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
- export type OptionsInGroup = {
3
- [key: string]: boolean | undefined;
4
- };
5
- export 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
- * __Selection store context__
13
- *
14
- * A context that stores the selection state of the dropdown menu items.
15
- */
16
- export declare const SelectionStoreContext: React.Context<SelectionStoreContextProps>;
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- type SelectionStoreProps = {
3
- children: React.ReactNode;
4
- };
5
- /**
6
- * Selection store will persist data as long as it remains mounted.
7
- * It handles the uncontrolled story for dropdown menu when the menu
8
- * items can be mounted/unmounted depending if the menu is open or closed.
9
- */
10
- declare const SelectionStore: (props: SelectionStoreProps) => React.JSX.Element;
11
- export default SelectionStore;
@@ -1,17 +0,0 @@
1
- type CheckboxStateArgs = {
2
- id: string;
3
- isSelected: boolean | undefined;
4
- defaultSelected: boolean | undefined;
5
- };
6
- type SetStateCallback = (value: boolean | undefined) => boolean;
7
- 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;
@@ -1,12 +0,0 @@
1
- type RadioStateArgs = {
2
- id: string;
3
- isSelected: boolean | undefined;
4
- defaultSelected: boolean | undefined;
5
- };
6
- type SetStateCallback = (value: boolean | undefined) => boolean;
7
- type RadioStateValue = [
8
- boolean,
9
- (newValue: SetStateCallback) => void
10
- ];
11
- declare function useRadioState({ id, isSelected, defaultSelected }: RadioStateArgs): RadioStateValue;
12
- export default useRadioState;
@@ -1,3 +0,0 @@
1
- import { type MutableRefObject } from 'react';
2
- declare function useRegisterItemWithFocusManager(hasPopup?: boolean): MutableRefObject<HTMLAnchorElement | HTMLButtonElement | null>;
3
- export default useRegisterItemWithFocusManager;
@@ -1,2 +0,0 @@
1
- export { useArrowNavigation, isAtCurrentMenuLevel, type TUseArrowNavigationArgs, } from './use-arrow-navigation';
2
- export { getFirstFocusable } from '@atlaskit/top-layer/focus';
@@ -1 +0,0 @@
1
- export { useArrowNavigation, isAtCurrentMenuLevel, type TUseArrowNavigationArgs, } from '@atlaskit/top-layer/use-arrow-navigation';
@@ -1,3 +0,0 @@
1
- import { type RefObject } from 'react';
2
- import { type FocusableElementRef } from '../../types';
3
- export default function handleFocus(refs: RefObject<FocusableElementRef[]>, isLayerDisabled: () => boolean, onClose: (e: KeyboardEvent) => void, isNestedMenu?: boolean): (e: KeyboardEvent) => void;
@@ -1 +0,0 @@
1
- export default function isCheckboxItem(element: HTMLElement): boolean;
@@ -1 +0,0 @@
1
- export default function isCheckboxItem(element: HTMLElement): boolean;
@@ -1,2 +0,0 @@
1
- declare const isVoiceOverSupported: () => boolean;
2
- export default isVoiceOverSupported;
@@ -1,4 +0,0 @@
1
- declare const resetOptionsInGroup: (group: {
2
- [key: string]: boolean | undefined;
3
- }) => {};
4
- export default resetOptionsInGroup;
@@ -1,6 +0,0 @@
1
- export declare const PREFIX = "ds--dropdown--";
2
- /**
3
- * useGeneratedId generates a random string which remains constant across
4
- * renders when called without any parameter.
5
- */
6
- export default function useGeneratedId(): string;
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import { type SectionProps } from '@atlaskit/menu';
3
- interface DropdownItemRadioGroupProps extends SectionProps {
4
- id: string;
5
- }
6
- /**
7
- * __Dropdown item radio group__
8
- * Store which manages the selection state for each DropdownItemRadio
9
- * across mount and unmounts.
10
- *
11
- */
12
- declare const DropdownItemRadioGroup: ({ children, hasSeparator, id, isList, isScrollable, testId, title, ...rest }: DropdownItemRadioGroupProps) => React.JSX.Element;
13
- export default DropdownItemRadioGroup;
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import { type 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: ({ children, defaultSelected, testId, id, title, description, isDisabled, isSelected, onClick: providedOnClick, shouldDescriptionWrap, shouldTitleWrap, interactionName, ...rest }: DropdownItemRadioProps) => React.JSX.Element;
13
- export default DropdownItemRadio;
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- interface RadioGroupContextProps {
3
- id: string;
4
- radioGroupState: {
5
- [key: string]: boolean | undefined;
6
- };
7
- selectRadioItem: (id: string, value: boolean) => void;
8
- }
9
- /**
10
- * __Radio group context__
11
- * Context provider that wraps each DropdownItemRadioGroup
12
- */
13
- export declare const RadioGroupContext: React.Context<RadioGroupContextProps>;
14
- export {};
@@ -1,435 +0,0 @@
1
- import { type KeyboardEvent, type MouseEvent, type ReactElement, type ReactNode, type Ref, type RefObject } from 'react';
2
- import type { CustomItemComponentProps, CustomItemProps, MenuGroupProps, SectionProps } from '@atlaskit/menu/types';
3
- import type { ContentProps, TriggerProps } from '@atlaskit/popup/types';
4
- export type FocusableElementRef = RefObject<HTMLAnchorElement | HTMLButtonElement>;
5
- export type Action = 'next' | 'prev' | 'first' | 'last' | 'tab';
6
- export 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 type ItemId = string;
8
- export type GroupId = string;
9
- export type CachedItem = {
10
- id: ItemId;
11
- groupId: GroupId;
12
- };
13
- export type FocusItem = {
14
- itemId: ItemId;
15
- itemNode: HTMLElement;
16
- };
17
- export type Behaviors = 'checkbox' | 'radio' | 'menuitemcheckbox' | 'menuitemradio';
18
- export interface CustomTriggerProps<TriggerElement extends HTMLElement = any> 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
- * onFocus handler that should be applied to the trigger. Used to bind onKeyDown listener
33
- * to the window object to track ArrowDown events.
34
- */
35
- onFocus?: () => void;
36
- /**
37
- * onBlur handler that should be applied to the trigger. Used to unbind onKeyDown listener
38
- * from the window object.
39
- */
40
- onBlur?: () => void;
41
- /**
42
- * A `testId` prop is provided for specified elements, which is a unique
43
- * string that appears as a data attribute `data-testid` in the rendered code,
44
- * serving as a hook for automated tests.
45
- *
46
- * As dropdown-menu is composed of different components, we passed down the testId to the sub component you want to test:
47
- * - `testId--trigger` to get the menu trigger.
48
- * - `testId--content` to get the dropdown content trigger.
49
- */
50
- testId?: string;
51
- }
52
- export interface OnOpenChangeArgs {
53
- isOpen: boolean;
54
- /**
55
- * The event that triggered the close.
56
- * The value will be `null` when the dropdown is closed programatically and has no corresponding event.
57
- */
58
- event: Event | MouseEvent | KeyboardEvent | null;
59
- }
60
- export interface MenuWrapperProps extends MenuGroupProps {
61
- setInitialFocusRef?: ContentProps['setInitialFocusRef'];
62
- onClose?: ContentProps['onClose'];
63
- onUpdate: ContentProps['update'];
64
- isLoading?: InternalDropdownMenuProps['isLoading'];
65
- statusLabel?: InternalDropdownMenuProps['statusLabel'];
66
- shouldRenderToParent?: boolean;
67
- isTriggeredUsingKeyboard?: boolean;
68
- autoFocus?: boolean;
69
- }
70
- export interface DropdownMenuGroupProps extends SectionProps {
71
- }
72
- interface InternalDropdownMenuProps<TriggerElement extends HTMLElement = any> {
73
- /**
74
- * Controls the appearance of the menu.
75
- * The default menu will scroll after its height exceeds the pre-defined amount.
76
- * The tall menu won't scroll until the height exceeds the height of the viewport.
77
- */
78
- appearance?: 'default' | 'tall';
79
- /**
80
- * Controls if the first menu item receives focus when menu is opened. Note that the menu has a focus lock
81
- * which traps the focus within the menu. The first item gets focus automatically
82
- * if the menu is triggered using the keyboard.
83
- *
84
- */
85
- autoFocus?: boolean;
86
- /**
87
- * Content that will be rendered inside the layer element. Should typically be
88
- * `DropdownItemGroup` or `DropdownItem`, or the checkbox and radio variants of those.
89
- */
90
- children?: ReactNode;
91
- /**
92
- * If true, a spinner is rendered instead of the items.
93
- */
94
- isLoading?: boolean;
95
- /**
96
- * Text to be used as status for assistive technologies. Defaults to "Loading".
97
- */
98
- statusLabel?: string;
99
- /**
100
- * Controls the open state of the dropdown.
101
- */
102
- isOpen?: boolean;
103
- /**
104
- * Position of the menu.
105
- */
106
- placement?: Placement;
107
- /**
108
- * This fits the dropdown menu width to its parent's width.
109
- * When set to `true`, the trigger and dropdown menu elements will be wrapped in a `div` with `position: relative`.
110
- * The dropdown menu will be rendered as a sibling to the trigger element, and will be full width.
111
- * The default is `false`.
112
- */
113
- shouldFitContainer?: boolean;
114
- /**
115
- * Allows the dropdown menu to be placed on the opposite side of its trigger if it does not
116
- * fit in the viewport.
117
- *
118
- * @private
119
- * @deprecated No-op when `platform-dst-top-layer` is enabled — CSS Anchor Positioning
120
- * handles flipping natively via `position-try-fallbacks`.
121
- */
122
- shouldFlip?: boolean;
123
- /**
124
- * Controls whether the popup is rendered inline within its parent component or in a portal at the document root.
125
- * `true` renders the dropdown menu in the DOM node closest to the trigger; focus is not trapped inside the element.
126
- * `false` renders the dropdown menu in React.Portal and focus is trapped inside the element.
127
- * Defaults to `false`.
128
- *
129
- * @private
130
- * @deprecated No-op when `platform-dst-top-layer` is enabled — content always
131
- * renders in the browser's top layer.
132
- */
133
- shouldRenderToParent?: boolean;
134
- /**
135
- * Controls the spacing density of the menu.
136
- */
137
- spacing?: Extract<MenuGroupProps['spacing'], 'cozy' | 'compact'>;
138
- /**
139
- * Content that triggers the dropdown menu to open and close. Use with
140
- * `triggerType` to get a button trigger. To customize the trigger element,
141
- * provide a function to this prop. You can find
142
- * [examples for custom triggers](https://atlassian.design/components/dropdown-menu/examples#custom-triggers)
143
- * in our documentation.
144
- */
145
- trigger?: string | ((triggerButtonProps: CustomTriggerProps<TriggerElement>) => ReactElement);
146
- /**
147
- * A `testId` prop is provided for specified elements, which is a unique
148
- * string that appears as a data attribute `data-testid` in the rendered code,
149
- * serving as a hook for automated tests.
150
- *
151
- * As dropdown-menu is composed of different components, we passed down the testId to the sub component you want to test:
152
- * - `testId--trigger` to get the menu trigger.
153
- * - `testId--content` to get the dropdown content trigger.
154
- */
155
- testId?: string;
156
- /**
157
- * Controls the initial open state of the dropdown. If provided, the component is considered to be controlled
158
- * which means that the user is responsible for managing the open and close state of the menu.
159
- * Using `defaultOpen` may cause accessiblity issues because it will automatically shift focus to the first menu item; which can be disorienting.
160
- * Only use this if action on the menu is required to proceed.
161
- */
162
- defaultOpen?: boolean;
163
- /**
164
- * Called when the menu should be open/closed. Receives an object with `isOpen` state.
165
- *
166
- * If the dropdown was closed programatically, the `event` parameter will be `null`.
167
- */
168
- onOpenChange?: (args: OnOpenChangeArgs) => void;
169
- /**
170
- * Z-index that the popup should be displayed in.
171
- * This is passed to the portal component.
172
- * Defaults to `layers.modal()` from `@atlaskit/theme` which is 510.
173
- *
174
- * @private
175
- * @deprecated No-op when `platform-dst-top-layer` is enabled — the browser's
176
- * top layer manages stacking without z-index.
177
- */
178
- zIndex?: number;
179
- /**
180
- * Provide an accessible label via `aria-label` for assistive technology.
181
- */
182
- label?: string;
183
- /**
184
- * If ref is passed, focus returns to that specific ref element after dropdown dismissed.
185
- */
186
- returnFocusRef?: RefObject<HTMLElement>;
187
- /**
188
- * An optional name used to identify events for [React UFO (Unified Frontend Observability) press interactions](https://developer.atlassian.com/platform/ufo/react-ufo/react-ufo/getting-started/#quick-start--press-interactions). For more information, see [React UFO integration into Design System components](https://go.atlassian.com/react-ufo-dst-integration).
189
- */
190
- interactionName?: string;
191
- /**
192
- * This controls the positioning strategy to use. Can vary between `absolute` and `fixed`.
193
- * The default is `fixed`.
194
- *
195
- * @private
196
- * @deprecated No-op when `platform-dst-top-layer` is enabled — CSS Anchor Positioning
197
- * replaces Popper's positioning strategy.
198
- */
199
- strategy?: 'absolute' | 'fixed';
200
- /**
201
- * Provide an accessible label for the menu element for assistive technology.
202
- */
203
- menuLabel?: string;
204
- /**
205
- * Allows consumers to ignore specific close events, for example when an external overlay
206
- * should be treated as part of the dropdown interaction.
207
- */
208
- shouldIgnoreCloseEvent?: (event: Event | MouseEvent | KeyboardEvent) => boolean;
209
- /**
210
- * When set to true, will call stopPropagation on the ESCAPE key event.
211
- * This prevents the ESCAPE event from bubbling up to parent elements.
212
- *
213
- * @private
214
- * @deprecated No-op when `platform-dst-top-layer` is enabled — the native
215
- * popover dismiss handles Escape propagation.
216
- */
217
- shouldPreventEscapePropagation?: boolean;
218
- }
219
- type StandardDropdownMenuProps<TriggerElement extends HTMLElement = any> = InternalDropdownMenuProps<TriggerElement> & {
220
- shouldFitContainer?: false;
221
- };
222
- type ShouldFitContainerDropdownMenuProps<TriggerElement extends HTMLElement = any> = InternalDropdownMenuProps<TriggerElement> & {
223
- shouldFitContainer: true;
224
- shouldRenderToParent?: true;
225
- strategy?: 'absolute';
226
- };
227
- export type DropdownMenuProps<TriggerElement extends HTMLElement = any> = StandardDropdownMenuProps<TriggerElement> | ShouldFitContainerDropdownMenuProps<TriggerElement>;
228
- export interface DropdownItemProps {
229
- /**
230
- * Primary content for the item.
231
- */
232
- children: React.ReactNode;
233
- /**
234
- * Custom component to render as an item.
235
- * Should be wrapped in `forwardRef` to avoid accessibility issues when controlling keyboard focus.
236
- */
237
- component?: CustomItemProps['component'];
238
- /**
239
- * Description of the item.
240
- * This will render smaller text below the primary text of the item as well as slightly increasing the height of the item.
241
- */
242
- description?: string | JSX.Element;
243
- /**
244
- * Makes the element appear disabled. This will remove interactivity and the item won't appear in the focus order.
245
- */
246
- isDisabled?: boolean;
247
- /**
248
- * When `true` the title of the item will wrap multiple lines if it exceeds the width of the dropdown menu.
249
- */
250
- shouldTitleWrap?: boolean;
251
- /**
252
- * When `true` the description of the item will wrap multiple lines if it exceeds the width of the dropdown menu.
253
- */
254
- shouldDescriptionWrap?: boolean;
255
- /**
256
- * Event that is triggered when the element is clicked.
257
- */
258
- onClick?: (e: MouseEvent | KeyboardEvent) => void;
259
- /**
260
- * Makes the element appear selected.
261
- */
262
- isSelected?: boolean;
263
- /**
264
- * Link to another page.
265
- */
266
- href?: string;
267
- /**
268
- * Where to display the linked URL,
269
- * see [anchor information](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a) on mdn for more information.
270
- */
271
- target?: string;
272
- /**
273
- * Adds a title attribute to the root item element.
274
- */
275
- title?: string;
276
- /**
277
- * Element to render before the item text.
278
- * Generally should be an [icon](https://atlaskit.atlassian.com/packages/design-system/icon) component.
279
- */
280
- elemBefore?: React.ReactNode;
281
- /**
282
- * Element to render after the item text.
283
- * Generally should be an [icon](https://atlaskit.atlassian.com/packages/design-system/icon) component.
284
- */
285
- elemAfter?: React.ReactNode;
286
- /**
287
- * The relationship of the linked URL as space-separated link types.
288
- * Generally you'll want to set this to "noopener noreferrer" when `target` is "_blank".
289
- */
290
- rel?: string;
291
- /**
292
- * A `testId` prop is provided for specified elements,
293
- * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
294
- * serving as a hook for automated tests.
295
- */
296
- testId?: string;
297
- /**
298
- * Use this to opt out of using a router link and instead use a regular anchor element when
299
- * using the `href` prop.
300
- * Marked as "unsafe" because ideally, router links should be used for all internal links.
301
- */
302
- UNSAFE_shouldDisableRouterLink?: boolean;
303
- /**
304
- * If ref is passed, focus returns to that specific ref element after dropdown item clicked.
305
- */
306
- returnFocusRef?: RefObject<HTMLElement>;
307
- /**
308
- * An optional name used to identify events for [React UFO (Unified Frontend Observability) press interactions](https://developer.atlassian.com/platform/ufo/react-ufo/react-ufo/getting-started/#quick-start--press-interactions). For more information, see [React UFO integration into Design System components](https://go.atlassian.com/react-ufo-dst-integration).
309
- */
310
- interactionName?: string;
311
- /**
312
- * An optional boolean value used to indicate if the dropdown item has popup or not.
313
- */
314
- 'aria-haspopup'?: boolean | 'dialog';
315
- /**
316
- * An optional string value that specifies the role of the dropdown item.
317
- * Use this to indicate whether the item is
318
- * or presentational (e.g., 'presentation') for accessibility purposes.
319
- * If not specified, it defaults to role="menuitem".
320
- */
321
- role?: string;
322
- }
323
- export interface DropdownItemCheckboxProps {
324
- /**
325
- * Primary content for the item.
326
- */
327
- children: React.ReactNode;
328
- /**
329
- * Description of the item.
330
- * This will render smaller text below the primary text of the item as well as slightly increasing the height of the item.
331
- */
332
- description?: string | JSX.Element;
333
- /**
334
- * Makes the checkbox appear disabled as well as removing interactivity.
335
- */
336
- isDisabled?: boolean;
337
- /**
338
- * When `true` the title of the item will wrap multiple lines if it's long enough.
339
- */
340
- shouldTitleWrap?: boolean;
341
- /**
342
- * When `true` the description of the item will wrap multiple lines if it's long enough.
343
- */
344
- shouldDescriptionWrap?: boolean;
345
- /**
346
- * Event that is triggered when the checkbox is clicked.
347
- */
348
- onClick?: (e: MouseEvent | KeyboardEvent) => void;
349
- /**
350
- * Sets whether the checkbox is checked or unchecked.
351
- */
352
- isSelected?: boolean;
353
- /**
354
- * Sets whether the checkbox begins selected.
355
- */
356
- defaultSelected?: boolean;
357
- /**
358
- * Unique id of a checkbox.
359
- */
360
- id: string;
361
- /**
362
- * Adds a title attribute to the root item element.
363
- */
364
- title?: string;
365
- /**
366
- * A `testId` prop is provided for specified elements,
367
- * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
368
- * serving as a hook for automated tests.
369
- */
370
- testId?: string;
371
- /**
372
- * An optional name used to identify events for [React UFO (Unified Frontend Observability) press interactions](https://developer.atlassian.com/platform/ufo/react-ufo/react-ufo/getting-started/#quick-start--press-interactions). For more information, see [React UFO integration into Design System components](https://go.atlassian.com/react-ufo-dst-integration).
373
- */
374
- interactionName?: string;
375
- }
376
- export interface DropdownItemRadioProps {
377
- /**
378
- * Primary content for the item.
379
- */
380
- children: React.ReactNode;
381
- /**
382
- * Description of the item.
383
- * This will render smaller text below the primary text of the item as well as slightly increasing the height of the item.
384
- */
385
- description?: string | JSX.Element;
386
- /**
387
- * Makes the checkbox appear disabled as well as removing interactivity.
388
- */
389
- isDisabled?: boolean;
390
- /**
391
- * When `true` the title of the item will wrap multiple lines if it's long enough.
392
- */
393
- shouldTitleWrap?: boolean;
394
- /**
395
- * When `true` the description of the item will wrap multiple lines if it's long enough.
396
- */
397
- shouldDescriptionWrap?: boolean;
398
- /**
399
- * Event that is triggered when the checkbox is clicked.
400
- */
401
- onClick?: (e: MouseEvent | KeyboardEvent) => void;
402
- /**
403
- * Sets whether the checkbox is checked or unchecked.
404
- */
405
- isSelected?: boolean;
406
- /**
407
- * Sets whether the checkbox begins selected.
408
- */
409
- defaultSelected?: boolean;
410
- /**
411
- * Unique ID of the checkbox.
412
- */
413
- id: string;
414
- /**
415
- * Adds a title attribute to the root item element.
416
- */
417
- title?: string;
418
- /**
419
- * A `testId` prop is provided for specified elements,
420
- * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
421
- * serving as a hook for automated tests.
422
- */
423
- testId?: string;
424
- /**
425
- * An optional name used to identify events for [React UFO (Unified Frontend Observability) press interactions](https://developer.atlassian.com/platform/ufo/react-ufo/react-ufo/getting-started/#quick-start--press-interactions). For more information, see [React UFO integration into Design System components](https://go.atlassian.com/react-ufo-dst-integration).
426
- */
427
- interactionName?: string;
428
- }
429
- export interface CustomItemHtmlProps extends CustomItemComponentProps {
430
- /**
431
- * Link to another page.
432
- */
433
- href?: string;
434
- }
435
- export {};