@atlaskit/menu 1.11.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/cjs/internal/components/menu-item-primitive.js +1 -1
  3. package/dist/es2019/internal/components/menu-item-primitive.js +1 -1
  4. package/dist/esm/internal/components/menu-item-primitive.js +1 -1
  5. package/package.json +1 -4
  6. package/dist/types-ts4.5/entry-points/menu-item/button-item.d.ts +0 -1
  7. package/dist/types-ts4.5/entry-points/menu-item/custom-item.d.ts +0 -1
  8. package/dist/types-ts4.5/entry-points/menu-item/heading-item.d.ts +0 -1
  9. package/dist/types-ts4.5/entry-points/menu-item/link-item.d.ts +0 -1
  10. package/dist/types-ts4.5/entry-points/menu-item/skeleton-heading-item.d.ts +0 -1
  11. package/dist/types-ts4.5/entry-points/menu-item/skeleton-item.d.ts +0 -1
  12. package/dist/types-ts4.5/entry-points/menu-section/menu-group.d.ts +0 -1
  13. package/dist/types-ts4.5/entry-points/menu-section/popup-menu-group.d.ts +0 -1
  14. package/dist/types-ts4.5/entry-points/menu-section/section.d.ts +0 -1
  15. package/dist/types-ts4.5/index.d.ts +0 -11
  16. package/dist/types-ts4.5/internal/components/menu-context.d.ts +0 -18
  17. package/dist/types-ts4.5/internal/components/menu-item-primitive.d.ts +0 -18
  18. package/dist/types-ts4.5/internal/components/skeleton-shimmer.d.ts +0 -24
  19. package/dist/types-ts4.5/menu-item/button-item.d.ts +0 -12
  20. package/dist/types-ts4.5/menu-item/custom-item.d.ts +0 -18
  21. package/dist/types-ts4.5/menu-item/heading-item.d.ts +0 -13
  22. package/dist/types-ts4.5/menu-item/link-item.d.ts +0 -12
  23. package/dist/types-ts4.5/menu-item/skeleton-heading-item.d.ts +0 -12
  24. package/dist/types-ts4.5/menu-item/skeleton-item.d.ts +0 -12
  25. package/dist/types-ts4.5/menu-section/menu-group.d.ts +0 -13
  26. package/dist/types-ts4.5/menu-section/popup-menu-group.d.ts +0 -8
  27. package/dist/types-ts4.5/menu-section/section.d.ts +0 -12
  28. package/dist/types-ts4.5/types.d.ts +0 -396
  29. package/tmp/api-report-tmp.d.ts +0 -222
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @atlaskit/menu
2
2
 
3
+ ## 2.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#41355](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41355) [`cd1c813da18`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cd1c813da18) - Menu items now have a secondary selected state (border or notch), this was previously feature flagged for Atlassian experiences and is now available for everyone.
8
+
9
+ This change makes all menu items are now relatively positioned, if you had any child elements that leaned on this behaviour your experiences will now be broken!
10
+
11
+ For example the below code code previously the `div` would be positioned relatively to the menu group element. Now, it is positioned relatively to the button item element.
12
+
13
+ ```jsx
14
+ <MenuGroup>
15
+ <ButtonItem>
16
+ <div style={{ position: 'absolute', top: '100%' }} />
17
+ </ButtonItem>
18
+ </MenuGroup>
19
+ ```
20
+
21
+ As a path forward you should not be leaning on this behaviour. If you need a popup experience use `@atlaskit/dropdown-menu` or `@atlaskit/popup`.
22
+
3
23
  ## 1.11.1
4
24
 
5
25
  ### Patch Changes
@@ -214,7 +214,7 @@ var MenuItemPrimitive = function MenuItemPrimitive(_ref) {
214
214
  return (0, _react2.jsx)(_focusRing.default, {
215
215
  isInset: true
216
216
  }, children({
217
- className: cx([cn([(0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.menu-selected-state-change_0see9') && positionRelativeStyles, primitiveStyles, spacingMapStyles[spacing], !isDisabled && !isSelected && unselectedStyles, !isDisabled && isSelected && [selectedStyles, (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.menu-selected-state-change_0see9') && [selectionStyle === 'border' && selectedBorderStyles, selectionStyle === 'notch' && selectedNotchStyles]], isDisabled ? disabledStyles : interactiveStyles]), UNSAFE_className]),
217
+ className: cx([cn([positionRelativeStyles, primitiveStyles, spacingMapStyles[spacing], !isDisabled && !isSelected && unselectedStyles, !isDisabled && isSelected && [selectedStyles, [selectionStyle === 'border' && selectedBorderStyles, selectionStyle === 'notch' && selectedNotchStyles]], isDisabled ? disabledStyles : interactiveStyles]), UNSAFE_className]),
218
218
  children: (0, _react2.jsx)(_inline.default, {
219
219
  as: "span",
220
220
  spread: "space-between",
@@ -201,7 +201,7 @@ const MenuItemPrimitive = ({
201
201
  return jsx(FocusRing, {
202
202
  isInset: true
203
203
  }, children({
204
- className: cx([cn([getBooleanFF('platform.design-system-team.menu-selected-state-change_0see9') && positionRelativeStyles, primitiveStyles, spacingMapStyles[spacing], !isDisabled && !isSelected && unselectedStyles, !isDisabled && isSelected && [selectedStyles, getBooleanFF('platform.design-system-team.menu-selected-state-change_0see9') && [selectionStyle === 'border' && selectedBorderStyles, selectionStyle === 'notch' && selectedNotchStyles]], isDisabled ? disabledStyles : interactiveStyles]), UNSAFE_className]),
204
+ className: cx([cn([positionRelativeStyles, primitiveStyles, spacingMapStyles[spacing], !isDisabled && !isSelected && unselectedStyles, !isDisabled && isSelected && [selectedStyles, [selectionStyle === 'border' && selectedBorderStyles, selectionStyle === 'notch' && selectedNotchStyles]], isDisabled ? disabledStyles : interactiveStyles]), UNSAFE_className]),
205
205
  children: jsx(Inline, {
206
206
  as: "span",
207
207
  spread: "space-between",
@@ -206,7 +206,7 @@ var MenuItemPrimitive = function MenuItemPrimitive(_ref) {
206
206
  return jsx(FocusRing, {
207
207
  isInset: true
208
208
  }, children({
209
- className: cx([cn([getBooleanFF('platform.design-system-team.menu-selected-state-change_0see9') && positionRelativeStyles, primitiveStyles, spacingMapStyles[spacing], !isDisabled && !isSelected && unselectedStyles, !isDisabled && isSelected && [selectedStyles, getBooleanFF('platform.design-system-team.menu-selected-state-change_0see9') && [selectionStyle === 'border' && selectedBorderStyles, selectionStyle === 'notch' && selectedNotchStyles]], isDisabled ? disabledStyles : interactiveStyles]), UNSAFE_className]),
209
+ className: cx([cn([positionRelativeStyles, primitiveStyles, spacingMapStyles[spacing], !isDisabled && !isSelected && unselectedStyles, !isDisabled && isSelected && [selectedStyles, [selectionStyle === 'border' && selectedBorderStyles, selectionStyle === 'notch' && selectedNotchStyles]], isDisabled ? disabledStyles : interactiveStyles]), UNSAFE_className]),
210
210
  children: jsx(Inline, {
211
211
  as: "span",
212
212
  spread: "space-between",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/menu",
3
- "version": "1.11.1",
3
+ "version": "2.0.0",
4
4
  "description": "A collection of composable menu components that can be used anywhere.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -104,9 +104,6 @@
104
104
  ".": "./src/index.tsx"
105
105
  },
106
106
  "platform-feature-flags": {
107
- "platform.design-system-team.menu-selected-state-change_0see9": {
108
- "type": "boolean"
109
- },
110
107
  "platform.design-system-team.unsafe-overrides-killswitch_c8j9m": {
111
108
  "type": "boolean"
112
109
  }
@@ -1 +0,0 @@
1
- export { default } from '../../menu-item/button-item';
@@ -1 +0,0 @@
1
- export { default } from '../../menu-item/custom-item';
@@ -1 +0,0 @@
1
- export { default } from '../../menu-item/heading-item';
@@ -1 +0,0 @@
1
- export { default } from '../../menu-item/link-item';
@@ -1 +0,0 @@
1
- export { default } from '../../menu-item/skeleton-heading-item';
@@ -1 +0,0 @@
1
- export { default } from '../../menu-item/skeleton-item';
@@ -1 +0,0 @@
1
- export { default } from '../../menu-section/menu-group';
@@ -1 +0,0 @@
1
- export { default } from '../../menu-section/popup-menu-group';
@@ -1 +0,0 @@
1
- export { default } from '../../menu-section/section';
@@ -1,11 +0,0 @@
1
- export { default as ButtonItem } from './menu-item/button-item';
2
- export { default as LinkItem } from './menu-item/link-item';
3
- export { default as CustomItem } from './menu-item/custom-item';
4
- export { default as SkeletonItem } from './menu-item/skeleton-item';
5
- export { SpacingContext, SELECTION_STYLE_CONTEXT_DO_NOT_USE, } from './internal/components/menu-context';
6
- export { default as HeadingItem } from './menu-item/heading-item';
7
- export { default as SkeletonHeadingItem } from './menu-item/skeleton-heading-item';
8
- export { default as Section } from './menu-section/section';
9
- export { default as MenuGroup } from './menu-section/menu-group';
10
- export { default as PopupMenuGroup } from './menu-section/popup-menu-group';
11
- export type { ButtonItemProps, CSSFn, StatelessCSSFn, CustomItemComponentProps, CustomItemProps, HeadingItemProps, ItemState, LinkItemProps, MenuGroupProps, SectionProps, SkeletonHeadingItemProps, SkeletonItemProps, Dimension, MenuItemProps as BaseItemProps, Overrides, MenuGroupSizing, RenderFunction, SectionProps as SectionBaseProps, TitleOverrides, } from './types';
@@ -1,18 +0,0 @@
1
- /// <reference types="react" />
2
- export type SpacingMode = 'compact' | 'cozy';
3
- /**
4
- * __Spacing context__
5
- *
6
- * The spacing context is used to provide spacing values to menu item primitives.
7
- *
8
- * @internal Do not use directly.
9
- */
10
- export declare const SpacingContext: import("react").Context<SpacingMode>;
11
- /**
12
- * __Selection context__
13
- *
14
- * The selection context is used to set what selection mode the menu items display as.
15
- *
16
- * @internal Do not use directly.
17
- */
18
- export declare const SELECTION_STYLE_CONTEXT_DO_NOT_USE: import("react").Context<"notch" | "border" | "none">;
@@ -1,18 +0,0 @@
1
- import { jsx } from '@emotion/react';
2
- import type { MenuItemPrimitiveProps } from '../../types';
3
- /**
4
- * __Menu item primitive__
5
- *
6
- * Menu item primitive contains all the styles for menu items,
7
- * including support for selected, disabled, and interaction states.
8
- *
9
- * Using children as function prop you wire up this to your own host element.
10
- *
11
- * ```jsx
12
- * <MenuItemPrimitive>
13
- * {({ children, ...props }) => <button {...props}>{children}</button>}
14
- * </MenuItemPrimitive>
15
- * ```
16
- */
17
- declare const MenuItemPrimitive: ({ children, title, description, iconAfter, iconBefore, overrides, className: UNSAFE_externalClassName, shouldTitleWrap, shouldDescriptionWrap, isDisabled, isSelected, }: MenuItemPrimitiveProps) => jsx.JSX.Element;
18
- export default MenuItemPrimitive;
@@ -1,24 +0,0 @@
1
- /** @jsx jsx */
2
- import { ReactNode } from 'react';
3
- import { jsx } from '@emotion/react';
4
- type SkeletonShimmerProps = {
5
- children: ({ className }: {
6
- className?: string;
7
- }) => ReactNode;
8
- isShimmering?: boolean;
9
- };
10
- /**
11
- * __Skeleton shimmer__
12
- *
13
- * A skeleton shimmer is the animation shown on loading skeletons for
14
- * perceived performance and user satisfaction.
15
- *
16
- * This component provides a `className` through render props. This value will
17
- * have type:
18
- * + `string`, when `isShimmering={true}`.
19
- * + `undefined`, when `isShimmering={false}`.
20
- *
21
- * @internal
22
- */
23
- declare const SkeletonShimmer: ({ children, isShimmering, }: SkeletonShimmerProps) => jsx.JSX.Element;
24
- export default SkeletonShimmer;
@@ -1,12 +0,0 @@
1
- /// <reference types="react" />
2
- import type { ButtonItemProps } from '../types';
3
- /**
4
- * __Button item__
5
- *
6
- * A button item is used to populate a menu with items that are buttons.
7
- *
8
- * - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/button-item)
9
- * - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
10
- */
11
- declare const ButtonItem: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<ButtonItemProps & import("react").RefAttributes<HTMLElement>>>;
12
- export default ButtonItem;
@@ -1,18 +0,0 @@
1
- /// <reference types="react" />
2
- /** @jsx jsx */
3
- import type { CustomItemComponentProps, CustomItemProps } from '../types';
4
- interface CustomItemTypeGenericHackProps {
5
- <TComponentProps>(props: CustomItemProps<TComponentProps> & {
6
- ref?: any;
7
- } & Omit<TComponentProps, keyof CustomItemComponentProps>): JSX.Element | null;
8
- }
9
- /**
10
- * __Custom item__
11
- *
12
- * A custom item is used to populate a menu with items that can be any element.
13
- *
14
- * - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/custom-item)
15
- * - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
16
- */
17
- declare const CustomItem: CustomItemTypeGenericHackProps;
18
- export default CustomItem;
@@ -1,13 +0,0 @@
1
- /// <reference types="react" />
2
- import { jsx } from '@emotion/react';
3
- import type { HeadingItemProps } from '../types';
4
- /**
5
- * __Heading item__
6
- *
7
- * A heading item is used to describe sibling menu items.
8
- *
9
- * - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/heading-item)
10
- * - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
11
- */
12
- declare const HeadingItem: import("react").MemoExoticComponent<({ children, testId, id, cssFn, className: UNSAFE_className, ...rest }: HeadingItemProps) => jsx.JSX.Element>;
13
- export default HeadingItem;
@@ -1,12 +0,0 @@
1
- /// <reference types="react" />
2
- import type { LinkItemProps } from '../types';
3
- /**
4
- * __Link item__
5
- *
6
- * A link item is used to populate a menu with items that are links.
7
- *
8
- * - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/link-item)
9
- * - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
10
- */
11
- declare const LinkItem: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<LinkItemProps & import("react").RefAttributes<HTMLElement>>>;
12
- export default LinkItem;
@@ -1,12 +0,0 @@
1
- import { jsx } from '@emotion/react';
2
- import type { SkeletonHeadingItemProps } from '../types';
3
- /**
4
- * __Skeleton heading item__
5
- *
6
- * A skeleton heading item is used in place of a heading item when its contents it not ready.
7
- *
8
- * - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/skeleton-heading-item)
9
- * - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
10
- */
11
- declare const SkeletonHeadingItem: ({ isShimmering, testId, width, cssFn, }: SkeletonHeadingItemProps) => jsx.JSX.Element;
12
- export default SkeletonHeadingItem;
@@ -1,12 +0,0 @@
1
- import { jsx } from '@emotion/react';
2
- import type { SkeletonItemProps } from '../types';
3
- /**
4
- * __Skeleton item__
5
- *
6
- * A skeleton item is used in place of an item when its contents it not ready.
7
- *
8
- * - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/skeleton-item)
9
- * - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
10
- */
11
- declare const SkeletonItem: ({ hasAvatar, hasIcon, isShimmering, testId, width, cssFn, }: SkeletonItemProps) => jsx.JSX.Element;
12
- export default SkeletonItem;
@@ -1,13 +0,0 @@
1
- /** @jsx jsx */
2
- import { jsx } from '@emotion/react';
3
- import type { MenuGroupProps } from '../types';
4
- /**
5
- * __Menu group__
6
- *
7
- * A menu group includes all the actions or items in a menu.
8
- *
9
- * - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/menu-group)
10
- * - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
11
- */
12
- declare const MenuGroup: ({ isLoading, maxWidth, minWidth, minHeight, maxHeight, testId, role, spacing, className: UNSAFE_className, ...rest }: MenuGroupProps) => jsx.JSX.Element;
13
- export default MenuGroup;
@@ -1,8 +0,0 @@
1
- /** @jsx jsx */
2
- import { jsx } from '@emotion/react';
3
- import type { MenuGroupProps } from '../types';
4
- /**
5
- * @deprecated
6
- */
7
- declare const PopupMenuGroup: ({ maxWidth, minWidth, ...rest }: MenuGroupProps) => jsx.JSX.Element;
8
- export default PopupMenuGroup;
@@ -1,12 +0,0 @@
1
- /// <reference types="react" />
2
- import type { SectionProps } from '../types';
3
- /**
4
- * __Section__
5
- *
6
- * A section includes related actions or items in a menu.
7
- *
8
- * - [Examples](https://atlaskit.atlassian.com/packages/design-system/menu/docs/section)
9
- * - [Code](https://atlaskit.atlassian.com/packages/design-system/menu)
10
- */
11
- declare const Section: import("react").ForwardRefExoticComponent<SectionProps & import("react").RefAttributes<HTMLElement>>;
12
- export default Section;
@@ -1,396 +0,0 @@
1
- import { ComponentType, ReactNode, Ref } from 'react';
2
- import { CSSObject } from '@emotion/react';
3
- import type { SpacingMode } from './internal/components/menu-context';
4
- export interface RenderFunction<TProps = {}> {
5
- (Component: ComponentType | string, props: TProps): React.ReactNode;
6
- }
7
- /**
8
- * @deprecated This type is deprecated and will be removed in a future release. See DSP-2676 for more information.
9
- */
10
- export interface TitleOverrides {
11
- render?: RenderFunction<{
12
- className?: string;
13
- children: ReactNode;
14
- 'data-item-title': boolean;
15
- }>;
16
- }
17
- /**
18
- * @deprecated This type is deprecated and will be removed in a future release. See DSP-2676 for more information.
19
- */
20
- export interface Overrides {
21
- Title?: TitleOverrides;
22
- }
23
- export type Dimension = string | number;
24
- export interface MenuGroupSizing {
25
- /**
26
- * Useful to constrain the menu group minimum height to a specific value.
27
- */
28
- minHeight?: Dimension;
29
- /**
30
- * Useful to constrain the menu groups height to a specific value.
31
- * Needs to be set when wanting to have scrollable sections.
32
- */
33
- maxHeight?: Dimension;
34
- /**
35
- * Useful to constrain the menu group minimum width to a specific value.
36
- */
37
- minWidth?: Dimension;
38
- /**
39
- * Useful to constrain the menu group width to a specific value.
40
- */
41
- maxWidth?: Dimension;
42
- }
43
- export interface MenuGroupProps extends MenuGroupSizing {
44
- /**
45
- * Children of the menu group,
46
- * should generally be `Section` components.
47
- */
48
- children: React.ReactNode;
49
- /**
50
- * Used for telling assistive technologies that the menu group is loading.
51
- */
52
- isLoading?: boolean;
53
- /**
54
- * Configure the density of the MenuGroup content.
55
- */
56
- spacing?: SpacingMode;
57
- /**
58
- * Used to override the accessibility role for the element.
59
- */
60
- role?: string;
61
- /**
62
- * A `testId` prop is provided for specified elements,
63
- * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
64
- * serving as a hook for automated tests.
65
- */
66
- testId?: string;
67
- /**
68
- * Handler called when clicking on this element,
69
- * or any children elements.
70
- * Useful when needing to stop propagation of child events.
71
- */
72
- onClick?: (event: React.MouseEvent | React.KeyboardEvent) => void;
73
- }
74
- export interface SectionProps {
75
- /**
76
- * Unique identifier for the element.
77
- */
78
- id?: string;
79
- /**
80
- * Enables scrolling within the section.
81
- * Make sure to set `maxHeight` on the parent `MenuGroup` component else it will not work.
82
- */
83
- isScrollable?: boolean;
84
- /**
85
- * Will render a border at the top of the section.
86
- */
87
- hasSeparator?: boolean;
88
- /**
89
- * Children of the section,
90
- * should generally be `Item` or `Heading` components,
91
- * but can also be [`EmptyState`](https://atlaskit.atlassian.com/packages/design-system/empty-state)s when wanting to render errors.
92
- */
93
- children: React.ReactNode;
94
- /**
95
- * A `testId` prop is provided for specified elements,
96
- * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
97
- * serving as a hook for automated tests.
98
- */
99
- testId?: string;
100
- /**
101
- * @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
102
- */
103
- overrides?: {
104
- HeadingItem?: {
105
- /**
106
- * A function that overrides the styles of the component.
107
- * It receives the current styles and state and expects a styles object.
108
- */
109
- cssFn?: StatelessCSSFn;
110
- };
111
- };
112
- /**
113
- * The text passed into the internal HeadingItem. If a title is not provided,
114
- * the HeadingItem will not be rendered, and this component acts as a regular Section
115
- */
116
- title?: string;
117
- /**
118
- * Adds `<ul>` and `<li>` tags around the items for better semantic markup in a list of items.
119
- */
120
- isList?: boolean;
121
- }
122
- export interface MenuItemPrimitiveProps {
123
- children: (props: {
124
- className: string;
125
- children: React.ReactNode;
126
- }) => JSX.Element;
127
- title: React.ReactNode | undefined;
128
- description: React.ReactNode | undefined;
129
- iconAfter: React.ReactNode | undefined;
130
- iconBefore: React.ReactNode | undefined;
131
- /**
132
- * @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
133
- */
134
- overrides: Overrides | undefined;
135
- shouldTitleWrap: boolean | undefined;
136
- shouldDescriptionWrap: boolean | undefined;
137
- isDisabled: boolean | undefined;
138
- isSelected: boolean | undefined;
139
- className?: string;
140
- }
141
- export interface MenuItemProps {
142
- /**
143
- A function that overrides the styles of the component.
144
- It receives the current styles and state and expects a styles object.
145
-
146
- @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
147
- */
148
- cssFn?: CSSFn;
149
- /**
150
- * Element to render before the item text.
151
- * Generally should be an [icon](https://atlaskit.atlassian.com/packages/design-system/icon) component.
152
- */
153
- iconBefore?: React.ReactNode;
154
- /**
155
- * Element to render after the item text.
156
- * Generally should be an [icon](https://atlaskit.atlassian.com/packages/design-system/icon) component.
157
- */
158
- iconAfter?: React.ReactNode;
159
- /**
160
- * Event that is triggered when the element is clicked.
161
- */
162
- onClick?: (event: React.MouseEvent | React.KeyboardEvent) => void;
163
- /**
164
- * Event that is triggered when the element has been pressed.
165
- */
166
- onMouseDown?: React.MouseEventHandler;
167
- /**
168
- * Description of the item.
169
- * This will render smaller text below the primary text of the item as well as slightly increasing the height of the item.
170
- */
171
- description?: string | JSX.Element;
172
- /**
173
- * Makes the element appear disabled as well as removing interactivity.
174
- */
175
- isDisabled?: boolean;
176
- /**
177
- * Makes the element appear selected.
178
- */
179
- isSelected?: boolean;
180
- /**
181
- * Primary content for the item.
182
- */
183
- children?: React.ReactNode;
184
- /**
185
- * A `testId` prop is provided for specified elements,
186
- * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
187
- * serving as a hook for automated tests.
188
- */
189
- testId?: string;
190
- /**
191
- Custom overrides for the composed components.
192
-
193
- @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
194
- */
195
- overrides?: Overrides;
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
- export interface ButtonItemProps extends MenuItemProps {
206
- /**
207
- * Unique identifier for the element.
208
- */
209
- id?: string;
210
- /**
211
- * Used to override the accessibility role for the element.
212
- */
213
- role?: string;
214
- }
215
- export interface LinkItemProps extends MenuItemProps {
216
- /**
217
- * Link to another page.
218
- */
219
- href?: string;
220
- /**
221
- * Where to display the linked URL,
222
- * see [anchor information](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a) on mdn for more information.
223
- */
224
- target?: string;
225
- /**
226
- * The relationship of the linked URL as space-separated link types.
227
- * Generally you'll want to set this to "noopener noreferrer" when `target` is "_blank".
228
- */
229
- rel?: string;
230
- /**
231
- * Used to override the accessibility role for the element.
232
- */
233
- role?: string;
234
- }
235
- export interface CustomItemComponentProps {
236
- /**
237
- * The children of the item.
238
- */
239
- children: React.ReactNode;
240
- /**
241
- * Class to apply to the root container of the custom component,
242
- * ensure this has been applied so the consistent item styling is applied.
243
- */
244
- className: string;
245
- /**
246
- * Test id that is passed through to the custom component.
247
- */
248
- 'data-testid'?: string;
249
- /**
250
- * Event handler that is passed through to the custom component.
251
- */
252
- onClick?: (event: React.MouseEvent<HTMLElement>) => void;
253
- /**
254
- * Event handler that is passed through to the custom component.
255
- */
256
- onMouseDown?: (event: React.MouseEvent<HTMLElement>) => void;
257
- /**
258
- * Event handler that is passed through to the custom component.
259
- * Used to disable the element from being draggable.
260
- */
261
- onDragStart?: (event: React.DragEvent) => void;
262
- /**
263
- * Turns off the element being draggable.
264
- */
265
- draggable: boolean;
266
- /**
267
- * React ref for the raw DOM element,
268
- * make sure to place this on the outer most DOM element.
269
- */
270
- ref?: Ref<any>;
271
- /**
272
- * Makes the element appear disabled as well as removing interactivity.
273
- */
274
- tabIndex?: number;
275
- /**
276
- * Disabled attribute.
277
- */
278
- disabled?: boolean;
279
- }
280
- export interface CustomItemProps<TCustomComponentProps = CustomItemComponentProps> extends MenuItemProps {
281
- /**
282
- Custom component to render as an item. This can be both a functional component or a class component.
283
-
284
- __Will return `null` if no component is defined.__
285
-
286
- Props passed to `CustomItem` will be passed down to this component. If the props for `component` have TypeScript types,
287
- CustomItem will extend them, providing type safety for your custom item.
288
-
289
- e.g. `<CustomItem to="/link" component={RouterLink} />`
290
-
291
- __NOTE:__ Make sure the reference for this component does not change between renders else undefined behavior may happen.
292
- */
293
- component?: React.ComponentType<TCustomComponentProps>;
294
- }
295
- export interface SkeletonItemProps {
296
- /**
297
- * Renders a skeleton circle in the `iconBefore` location.
298
- * Takes priority over `hasIcon.
299
- */
300
- hasAvatar?: boolean;
301
- /**
302
- * Renders a skeleton square in the `iconBefore` location.
303
- */
304
- hasIcon?: boolean;
305
- /**
306
- *
307
- * Width of the skeleton item.
308
- * Generally you don't need to specify this as it has a staggered width based on `:nth-child` by default.
309
- */
310
- width?: Dimension;
311
- /**
312
- * A `testId` prop is provided for specified elements,
313
- * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
314
- * serving as a hook for automated tests.
315
- */
316
- testId?: string;
317
- /**
318
- * Causes to the skeleton to have a slight horizontal shimmer.
319
- * Only use this when you want to bring more attention to the loading content.
320
- */
321
- isShimmering?: boolean;
322
- /**
323
- * A function that overrides the styles of this component.
324
- * It receives the current styles and returns a customized styles object.
325
- */
326
- cssFn?: StatelessCSSFn;
327
- }
328
- export interface HeadingItemProps {
329
- /**
330
- A function that overrides the styles.
331
- It receives the current styles and returns a customized styles object.
332
-
333
- @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
334
- */
335
- cssFn?: StatelessCSSFn;
336
- /**
337
- * The text of the heading.
338
- */
339
- children: React.ReactNode;
340
- /**
341
- * A unique identifier that can be referenced in the `labelledby` prop of a
342
- * section to allow screen readers to announce the name of groups.
343
- */
344
- id?: string;
345
- /**
346
- * A `testId` prop is provided for specified elements,
347
- * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
348
- * serving as a hook for automated tests.
349
- */
350
- testId?: string;
351
- }
352
- export interface SkeletonHeadingItemProps {
353
- /**
354
- *
355
- * Width of the skeleton heading item.
356
- * Generally you don't need to specify this as it has a staggered width based on `:nth-child` by default.
357
- */
358
- width?: Dimension;
359
- /**
360
- * A `testId` prop is provided for specified elements,
361
- * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
362
- * serving as a hook for automated tests.
363
- */
364
- testId?: string;
365
- /**
366
- * Causes to the skeleton to have a slight horizontal shimmer.
367
- * Only use this when you want to bring more attention to the loading content.
368
- */
369
- isShimmering?: boolean;
370
- /**
371
- A function that overrides the styles of this component.
372
- It receives the current styles and returns a customized styles object.
373
-
374
- @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
375
- */
376
- cssFn?: StatelessCSSFn;
377
- }
378
- export type ItemState = {
379
- isSelected: boolean;
380
- isDisabled: boolean;
381
- };
382
- /**
383
- A function that overrides the styles of
384
- menu components. It receives the current state
385
- and should return a CSSObject.
386
-
387
- @see @atlaskit/menu/docs/85-overriding-item-styles
388
- @deprecated This type is deprecated and will be removed in a future release. See DSP-2676 for more information.
389
- */
390
- export interface CSSFn<TState = ItemState extends void ? void : ItemState> {
391
- (currentState: TState): CSSObject | CSSObject[];
392
- }
393
- /**
394
- * @deprecated This type is deprecated and will be removed in a future release. See DSP-2676 for more information.
395
- */
396
- export type StatelessCSSFn = CSSFn<void>;
@@ -1,222 +0,0 @@
1
- ## API Report File for "@atlaskit/menu"
2
-
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
-
5
- ```ts
6
-
7
- /// <reference types="react" />
8
-
9
- import { ComponentType } from 'react';
10
- import { Context } from 'react';
11
- import { CSSObject } from '@emotion/react';
12
- import { ForwardRefExoticComponent } from 'react';
13
- import { jsx } from '@emotion/react';
14
- import { MemoExoticComponent } from 'react';
15
- import { ReactNode } from 'react';
16
- import { Ref } from 'react';
17
- import { RefAttributes } from 'react';
18
-
19
- // @public (undocumented)
20
- export interface BaseItemProps {
21
- children?: React.ReactNode;
22
- // @deprecated
23
- cssFn?: CSSFn;
24
- description?: JSX.Element | string;
25
- iconAfter?: React.ReactNode;
26
- iconBefore?: React.ReactNode;
27
- isDisabled?: boolean;
28
- isSelected?: boolean;
29
- onClick?: (event: React.KeyboardEvent | React.MouseEvent) => void;
30
- onMouseDown?: React.MouseEventHandler;
31
- // @deprecated
32
- overrides?: Overrides;
33
- shouldDescriptionWrap?: boolean;
34
- shouldTitleWrap?: boolean;
35
- testId?: string;
36
- }
37
-
38
- // @public
39
- export const ButtonItem: MemoExoticComponent<ForwardRefExoticComponent<ButtonItemProps & RefAttributes<HTMLElement>>>;
40
-
41
- // @public (undocumented)
42
- export interface ButtonItemProps extends BaseItemProps {
43
- id?: string;
44
- role?: string;
45
- }
46
-
47
- // @public @deprecated
48
- export interface CSSFn<TState = ItemState extends void ? void : ItemState> {
49
- // (undocumented)
50
- (currentState: TState): CSSObject | CSSObject[];
51
- }
52
-
53
- // @public
54
- export const CustomItem: CustomItemTypeGenericHackProps;
55
-
56
- // @public (undocumented)
57
- export interface CustomItemComponentProps {
58
- 'data-testid'?: string;
59
- children: React.ReactNode;
60
- className: string;
61
- disabled?: boolean;
62
- draggable: boolean;
63
- onClick?: (event: React.MouseEvent<HTMLElement>) => void;
64
- onDragStart?: (event: React.DragEvent) => void;
65
- onMouseDown?: (event: React.MouseEvent<HTMLElement>) => void;
66
- ref?: Ref<any>;
67
- tabIndex?: number;
68
- }
69
-
70
- // @public (undocumented)
71
- export interface CustomItemProps<TCustomComponentProps = CustomItemComponentProps> extends BaseItemProps {
72
- component?: React.ComponentType<TCustomComponentProps>;
73
- }
74
-
75
- // @public (undocumented)
76
- interface CustomItemTypeGenericHackProps {
77
- // (undocumented)
78
- <TComponentProps>(props: CustomItemProps<TComponentProps> & {
79
- ref?: any;
80
- } & Omit<TComponentProps, keyof CustomItemComponentProps>): JSX.Element | null;
81
- }
82
-
83
- // @public (undocumented)
84
- export type Dimension = number | string;
85
-
86
- // @public
87
- export const HeadingItem: MemoExoticComponent<({ children, testId, id, cssFn, className: UNSAFE_className, ...rest }: HeadingItemProps) => jsx.JSX.Element>;
88
-
89
- // @public (undocumented)
90
- export interface HeadingItemProps {
91
- children: React.ReactNode;
92
- // @deprecated
93
- cssFn?: StatelessCSSFn;
94
- id?: string;
95
- testId?: string;
96
- }
97
-
98
- // @public (undocumented)
99
- export type ItemState = {
100
- isSelected: boolean;
101
- isDisabled: boolean;
102
- };
103
-
104
- // @public
105
- export const LinkItem: MemoExoticComponent<ForwardRefExoticComponent<LinkItemProps & RefAttributes<HTMLElement>>>;
106
-
107
- // @public (undocumented)
108
- export interface LinkItemProps extends BaseItemProps {
109
- href?: string;
110
- rel?: string;
111
- role?: string;
112
- target?: string;
113
- }
114
-
115
- // @public
116
- export const MenuGroup: ({ isLoading, maxWidth, minWidth, minHeight, maxHeight, testId, role, spacing, className: UNSAFE_className, ...rest }: MenuGroupProps) => jsx.JSX.Element;
117
-
118
- // @public (undocumented)
119
- export interface MenuGroupProps extends MenuGroupSizing {
120
- children: React.ReactNode;
121
- isLoading?: boolean;
122
- onClick?: (event: React.KeyboardEvent | React.MouseEvent) => void;
123
- role?: string;
124
- spacing?: SpacingMode;
125
- testId?: string;
126
- }
127
-
128
- // @public (undocumented)
129
- export interface MenuGroupSizing {
130
- maxHeight?: Dimension;
131
- maxWidth?: Dimension;
132
- minHeight?: Dimension;
133
- minWidth?: Dimension;
134
- }
135
-
136
- // @public @deprecated (undocumented)
137
- export interface Overrides {
138
- // (undocumented)
139
- Title?: TitleOverrides;
140
- }
141
-
142
- // @public @deprecated (undocumented)
143
- export const PopupMenuGroup: ({ maxWidth, minWidth, ...rest }: MenuGroupProps) => jsx.JSX.Element;
144
-
145
- // @public (undocumented)
146
- export interface RenderFunction<TProps = {}> {
147
- // (undocumented)
148
- (Component: ComponentType | string, props: TProps): React.ReactNode;
149
- }
150
-
151
- // @public
152
- export const Section: ForwardRefExoticComponent<SectionProps & RefAttributes<HTMLElement>>;
153
-
154
- // @public (undocumented)
155
- interface SectionProps {
156
- children: React.ReactNode;
157
- hasSeparator?: boolean;
158
- id?: string;
159
- isList?: boolean;
160
- isScrollable?: boolean;
161
- // @deprecated (undocumented)
162
- overrides?: {
163
- HeadingItem?: {
164
- cssFn?: StatelessCSSFn;
165
- };
166
- };
167
- testId?: string;
168
- title?: string;
169
- }
170
- export { SectionProps as SectionBaseProps }
171
- export { SectionProps }
172
-
173
- // @internal
174
- export const SELECTION_STYLE_CONTEXT_DO_NOT_USE: Context<"border" | "none" | "notch">;
175
-
176
- // @public
177
- export const SkeletonHeadingItem: ({ isShimmering, testId, width, cssFn, }: SkeletonHeadingItemProps) => jsx.JSX.Element;
178
-
179
- // @public (undocumented)
180
- export interface SkeletonHeadingItemProps {
181
- // @deprecated
182
- cssFn?: StatelessCSSFn;
183
- isShimmering?: boolean;
184
- testId?: string;
185
- width?: Dimension;
186
- }
187
-
188
- // @public
189
- export const SkeletonItem: ({ hasAvatar, hasIcon, isShimmering, testId, width, cssFn, }: SkeletonItemProps) => jsx.JSX.Element;
190
-
191
- // @public (undocumented)
192
- export interface SkeletonItemProps {
193
- cssFn?: StatelessCSSFn;
194
- hasAvatar?: boolean;
195
- hasIcon?: boolean;
196
- isShimmering?: boolean;
197
- testId?: string;
198
- width?: Dimension;
199
- }
200
-
201
- // @internal
202
- export const SpacingContext: Context<SpacingMode>;
203
-
204
- // @public (undocumented)
205
- type SpacingMode = 'compact' | 'cozy';
206
-
207
- // @public @deprecated (undocumented)
208
- export type StatelessCSSFn = CSSFn<void>;
209
-
210
- // @public @deprecated (undocumented)
211
- export interface TitleOverrides {
212
- // (undocumented)
213
- render?: RenderFunction<{
214
- className?: string;
215
- children: ReactNode;
216
- 'data-item-title': boolean;
217
- }>;
218
- }
219
-
220
- // (No @packageDocumentation comment for this package)
221
-
222
- ```