@atlaskit/menu 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/codemods/helpers/generic.tsx +10 -12
  3. package/dist/cjs/version.json +1 -1
  4. package/dist/es2019/version.json +1 -1
  5. package/dist/esm/version.json +1 -1
  6. package/package.json +4 -12
  7. package/report.api.md +16 -14
  8. package/dist/types-ts4.0/entry-points/menu-item/button-item.d.ts +0 -1
  9. package/dist/types-ts4.0/entry-points/menu-item/custom-item.d.ts +0 -1
  10. package/dist/types-ts4.0/entry-points/menu-item/heading-item.d.ts +0 -1
  11. package/dist/types-ts4.0/entry-points/menu-item/link-item.d.ts +0 -1
  12. package/dist/types-ts4.0/entry-points/menu-item/skeleton-heading-item.d.ts +0 -1
  13. package/dist/types-ts4.0/entry-points/menu-item/skeleton-item.d.ts +0 -1
  14. package/dist/types-ts4.0/entry-points/menu-section/menu-group.d.ts +0 -1
  15. package/dist/types-ts4.0/entry-points/menu-section/popup-menu-group.d.ts +0 -1
  16. package/dist/types-ts4.0/entry-points/menu-section/section.d.ts +0 -1
  17. package/dist/types-ts4.0/index.d.ts +0 -10
  18. package/dist/types-ts4.0/internal/components/menu-item-primitive.d.ts +0 -18
  19. package/dist/types-ts4.0/internal/components/skeleton-shimmer.d.ts +0 -24
  20. package/dist/types-ts4.0/menu-item/button-item.d.ts +0 -12
  21. package/dist/types-ts4.0/menu-item/custom-item.d.ts +0 -18
  22. package/dist/types-ts4.0/menu-item/heading-item.d.ts +0 -13
  23. package/dist/types-ts4.0/menu-item/link-item.d.ts +0 -12
  24. package/dist/types-ts4.0/menu-item/skeleton-heading-item.d.ts +0 -12
  25. package/dist/types-ts4.0/menu-item/skeleton-item.d.ts +0 -12
  26. package/dist/types-ts4.0/menu-section/menu-group.d.ts +0 -13
  27. package/dist/types-ts4.0/menu-section/popup-menu-group.d.ts +0 -8
  28. package/dist/types-ts4.0/menu-section/section.d.ts +0 -12
  29. package/dist/types-ts4.0/types.d.ts +0 -383
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/menu
2
2
 
3
+ ## 1.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
3
9
  ## 1.4.0
4
10
 
5
11
  ### Minor Changes
@@ -562,19 +562,17 @@ export function changeImportFor({
562
562
  .filter((path) => path.node.source.value === oldPackagePath)
563
563
  .find(j.ImportSpecifier)
564
564
  .nodes()
565
- .map(
566
- (specifier): Nullable<string> => {
567
- if (specifier.imported.name !== currentName) {
568
- return null;
569
- }
570
- // If aliased: return the alias
571
- if (specifier.local && specifier.local.name !== currentName) {
572
- return specifier.local.name;
573
- }
574
-
565
+ .map((specifier): Nullable<string> => {
566
+ if (specifier.imported.name !== currentName) {
575
567
  return null;
576
- },
577
- )
568
+ }
569
+ // If aliased: return the alias
570
+ if (specifier.local && specifier.local.name !== currentName) {
571
+ return specifier.local.name;
572
+ }
573
+
574
+ return null;
575
+ })
578
576
  .filter(Boolean)[0] || null;
579
577
 
580
578
  base
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/menu",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/menu",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/menu",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/menu",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "A collection of composable menu components that can be used anywhere.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -12,14 +12,6 @@
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
- },
23
15
  "sideEffects": false,
24
16
  "atlaskit:src": "src/index.tsx",
25
17
  "atlassian": {
@@ -45,11 +37,11 @@
45
37
  ".": "./src/index.tsx"
46
38
  },
47
39
  "dependencies": {
48
- "@atlaskit/ds-explorations": "^1.0.0",
40
+ "@atlaskit/ds-explorations": "^1.2.0",
49
41
  "@atlaskit/ds-lib": "^2.1.0",
50
- "@atlaskit/focus-ring": "^1.1.0",
42
+ "@atlaskit/focus-ring": "^1.2.0",
51
43
  "@atlaskit/theme": "^12.2.0",
52
- "@atlaskit/tokens": "^0.10.0",
44
+ "@atlaskit/tokens": "^0.11.0",
53
45
  "@babel/runtime": "^7.0.0",
54
46
  "@emotion/react": "^11.7.1"
55
47
  },
package/report.api.md CHANGED
@@ -40,9 +40,9 @@ export interface BaseItemProps {
40
40
  }
41
41
 
42
42
  // @public
43
- export const ButtonItem: MemoExoticComponent<ForwardRefExoticComponent<
44
- ButtonItemProps & RefAttributes<HTMLElement>
45
- >>;
43
+ export const ButtonItem: MemoExoticComponent<
44
+ ForwardRefExoticComponent<ButtonItemProps & RefAttributes<HTMLElement>>
45
+ >;
46
46
 
47
47
  // @public (undocumented)
48
48
  export interface ButtonItemProps extends BaseItemProps {
@@ -75,7 +75,7 @@ export interface CustomItemComponentProps {
75
75
 
76
76
  // @public (undocumented)
77
77
  export interface CustomItemProps<
78
- TCustomComponentProps = CustomItemComponentProps
78
+ TCustomComponentProps = CustomItemComponentProps,
79
79
  > extends BaseItemProps {
80
80
  component?: React.ComponentType<TCustomComponentProps>;
81
81
  }
@@ -94,13 +94,15 @@ interface CustomItemTypeGenericHackProps {
94
94
  export type Dimension = string | number;
95
95
 
96
96
  // @public
97
- export const HeadingItem: MemoExoticComponent<({
98
- children,
99
- testId,
100
- id,
101
- cssFn,
102
- ...rest
103
- }: HeadingItemProps) => jsx.JSX.Element>;
97
+ export const HeadingItem: MemoExoticComponent<
98
+ ({
99
+ children,
100
+ testId,
101
+ id,
102
+ cssFn,
103
+ ...rest
104
+ }: HeadingItemProps) => jsx.JSX.Element
105
+ >;
104
106
 
105
107
  // @public (undocumented)
106
108
  export interface HeadingItemProps {
@@ -118,9 +120,9 @@ export type ItemState = {
118
120
  };
119
121
 
120
122
  // @public
121
- export const LinkItem: MemoExoticComponent<ForwardRefExoticComponent<
122
- LinkItemProps & RefAttributes<HTMLElement>
123
- >>;
123
+ export const LinkItem: MemoExoticComponent<
124
+ ForwardRefExoticComponent<LinkItemProps & RefAttributes<HTMLElement>>
125
+ >;
124
126
 
125
127
  // @public (undocumented)
126
128
  export interface LinkItemProps extends BaseItemProps {
@@ -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,10 +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 { default as HeadingItem } from './menu-item/heading-item';
6
- export { default as SkeletonHeadingItem } from './menu-item/skeleton-heading-item';
7
- export { default as Section } from './menu-section/section';
8
- export { default as MenuGroup } from './menu-section/menu-group';
9
- export { default as PopupMenuGroup } from './menu-section/popup-menu-group';
10
- 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
- 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, 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
- declare 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, ...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: ({ maxWidth, minWidth, minHeight, maxHeight, testId, role, ...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,383 +0,0 @@
1
- import { ComponentType, ReactNode, Ref } from 'react';
2
- import { CSSObject } from '@emotion/react';
3
- export interface RenderFunction<TProps = {}> {
4
- (Component: ComponentType | string, props: TProps): React.ReactNode;
5
- }
6
- /**
7
- * @deprecated This type is deprecated and will be removed in a future release. See DSP-2676 for more information.
8
- */
9
- export interface TitleOverrides {
10
- render?: RenderFunction<{
11
- className?: string;
12
- children: ReactNode;
13
- 'data-item-title': boolean;
14
- }>;
15
- }
16
- /**
17
- * @deprecated This type is deprecated and will be removed in a future release. See DSP-2676 for more information.
18
- */
19
- export interface Overrides {
20
- Title?: TitleOverrides;
21
- }
22
- export declare type Dimension = string | number;
23
- export interface MenuGroupSizing {
24
- /**
25
- * Useful to constrain the menu group minimum height to a specific value.
26
- */
27
- minHeight?: Dimension;
28
- /**
29
- * Useful to constrain the menu groups height to a specific value.
30
- * Needs to be set when wanting to have scrollable sections.
31
- */
32
- maxHeight?: Dimension;
33
- /**
34
- * Useful to constrain the menu group minimum width to a specific value.
35
- */
36
- minWidth?: Dimension;
37
- /**
38
- * Useful to constrain the menu group width to a specific value.
39
- */
40
- maxWidth?: Dimension;
41
- }
42
- export interface MenuGroupProps extends MenuGroupSizing {
43
- /**
44
- * Children of the menu group,
45
- * should generally be `Section` components.
46
- */
47
- children: React.ReactNode;
48
- /**
49
- * Used to override the accessibility role for the element.
50
- */
51
- role?: string;
52
- /**
53
- * A `testId` prop is provided for specified elements,
54
- * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
55
- * serving as a hook for automated tests.
56
- */
57
- testId?: string;
58
- /**
59
- * Handler called when clicking on this element,
60
- * or any children elements.
61
- * Useful when needing to stop propagation of child events.
62
- */
63
- onClick?: (event: React.MouseEvent | React.KeyboardEvent) => void;
64
- }
65
- export interface SectionProps {
66
- /**
67
- * Unique identifier for the element.
68
- */
69
- id?: string;
70
- /**
71
- * Enables scrolling within the section.
72
- * Make sure to set `maxHeight` on the parent `MenuGroup` component else it will not work.
73
- */
74
- isScrollable?: boolean;
75
- /**
76
- * Will render a border at the top of the section.
77
- */
78
- hasSeparator?: boolean;
79
- /**
80
- * Children of the section,
81
- * should generally be `Item` or `Heading` components,
82
- * but can also be [`EmptyState`](https://atlaskit.atlassian.com/packages/design-system/empty-state)s when wanting to render errors.
83
- */
84
- children: React.ReactNode;
85
- /**
86
- * A `testId` prop is provided for specified elements,
87
- * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
88
- * serving as a hook for automated tests.
89
- */
90
- testId?: string;
91
- /**
92
- * @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
93
- */
94
- overrides?: {
95
- HeadingItem?: {
96
- /**
97
- * A function that overrides the styles of the component.
98
- * It receives the current styles and state and expects a styles object.
99
- */
100
- cssFn?: StatelessCSSFn;
101
- };
102
- };
103
- /**
104
- * The text passed into the internal HeadingItem. If a title is not provided,
105
- * the HeadingItem will not be rendered, and this component acts as a regular Section
106
- */
107
- title?: string;
108
- }
109
- export interface MenuItemPrimitiveProps {
110
- children: (props: {
111
- className: string;
112
- children: React.ReactNode;
113
- }) => JSX.Element;
114
- title: React.ReactNode | undefined;
115
- description: React.ReactNode | undefined;
116
- iconAfter: React.ReactNode | undefined;
117
- iconBefore: React.ReactNode | undefined;
118
- /**
119
- * @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
120
- */
121
- overrides: Overrides | undefined;
122
- shouldTitleWrap: boolean | undefined;
123
- shouldDescriptionWrap: boolean | undefined;
124
- isDisabled: boolean | undefined;
125
- isSelected: boolean | undefined;
126
- className?: string;
127
- }
128
- export interface MenuItemProps {
129
- /**
130
- A function that overrides the styles of the component.
131
- It receives the current styles and state and expects a styles object.
132
-
133
- @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
134
- */
135
- cssFn?: CSSFn;
136
- /**
137
- * Element to render before the item text.
138
- * Generally should be an [icon](https://atlaskit.atlassian.com/packages/design-system/icon) component.
139
- */
140
- iconBefore?: React.ReactNode;
141
- /**
142
- * Element to render after the item text.
143
- * Generally should be an [icon](https://atlaskit.atlassian.com/packages/design-system/icon) component.
144
- */
145
- iconAfter?: React.ReactNode;
146
- /**
147
- * Event that is triggered when the element is clicked.
148
- */
149
- onClick?: (event: React.MouseEvent | React.KeyboardEvent) => void;
150
- /**
151
- * Event that is triggered when the element has been pressed.
152
- */
153
- onMouseDown?: React.MouseEventHandler;
154
- /**
155
- * Description of the item.
156
- * This will render smaller text below the primary text of the item as well as slightly increasing the height of the item.
157
- */
158
- description?: string | JSX.Element;
159
- /**
160
- * Makes the element appear disabled as well as removing interactivity.
161
- */
162
- isDisabled?: boolean;
163
- /**
164
- * Makes the element appear selected.
165
- */
166
- isSelected?: boolean;
167
- /**
168
- * Primary content for the item.
169
- */
170
- children?: React.ReactNode;
171
- /**
172
- * A `testId` prop is provided for specified elements,
173
- * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
174
- * serving as a hook for automated tests.
175
- */
176
- testId?: string;
177
- /**
178
- Custom overrides for the composed components.
179
-
180
- @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
181
- */
182
- overrides?: Overrides;
183
- /**
184
- * When `true` the title of the item will wrap multiple lines if it's long enough.
185
- */
186
- shouldTitleWrap?: boolean;
187
- /**
188
- * When `true` the description of the item will wrap multiple lines if it's long enough.
189
- */
190
- shouldDescriptionWrap?: boolean;
191
- }
192
- export interface ButtonItemProps extends MenuItemProps {
193
- /**
194
- * Unique identifier for the element.
195
- */
196
- id?: string;
197
- /**
198
- * Used to override the accessibility role for the element.
199
- */
200
- role?: string;
201
- }
202
- export interface LinkItemProps extends MenuItemProps {
203
- /**
204
- * Link to another page.
205
- */
206
- href?: string;
207
- /**
208
- * Where to display the linked URL,
209
- * see [anchor information](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a) on mdn for more information.
210
- */
211
- target?: string;
212
- /**
213
- * The relationship of the linked URL as space-separated link types.
214
- * Generally you'll want to set this to "noopener noreferrer" when `target` is "_blank".
215
- */
216
- rel?: string;
217
- /**
218
- * Used to override the accessibility role for the element.
219
- */
220
- role?: string;
221
- }
222
- export interface CustomItemComponentProps {
223
- /**
224
- * The children of the item.
225
- */
226
- children: React.ReactNode;
227
- /**
228
- * Class to apply to the root container of the custom component,
229
- * ensure this has been applied so the consistent item styling is applied.
230
- */
231
- className: string;
232
- /**
233
- * Test id that is passed through to the custom component.
234
- */
235
- 'data-testid'?: string;
236
- /**
237
- * Event handler that is passed through to the custom component.
238
- */
239
- onClick?: (event: React.MouseEvent<HTMLElement>) => void;
240
- /**
241
- * Event handler that is passed through to the custom component.
242
- */
243
- onMouseDown?: (event: React.MouseEvent<HTMLElement>) => void;
244
- /**
245
- * Event handler that is passed through to the custom component.
246
- * Used to disable the element from being draggable.
247
- */
248
- onDragStart?: (event: React.DragEvent) => void;
249
- /**
250
- * Turns off the element being draggable.
251
- */
252
- draggable: boolean;
253
- /**
254
- * React ref for the raw DOM element,
255
- * make sure to place this on the outer most DOM element.
256
- */
257
- ref?: Ref<any>;
258
- /**
259
- * Makes the element appear disabled as well as removing interactivity.
260
- */
261
- tabIndex?: number;
262
- /**
263
- * Disabled attribute.
264
- */
265
- disabled?: boolean;
266
- }
267
- export interface CustomItemProps<TCustomComponentProps = CustomItemComponentProps> extends MenuItemProps {
268
- /**
269
- Custom component to render as an item. This can be both a functional component or a class component.
270
-
271
- __Will return `null` if no component is defined.__
272
-
273
- Props passed to `CustomItem` will be passed down to this component. If the props for `component` have TypeScript types,
274
- CustomItem will extend them, providing type safety for your custom item.
275
-
276
- e.g. `<CustomItem to="/link" component={RouterLink} />`
277
-
278
- __NOTE:__ Make sure the reference for this component does not change between renders else undefined behavior may happen.
279
- */
280
- component?: React.ComponentType<TCustomComponentProps>;
281
- }
282
- export interface SkeletonItemProps {
283
- /**
284
- * Renders a skeleton circle in the `iconBefore` location.
285
- * Takes priority over `hasIcon.
286
- */
287
- hasAvatar?: boolean;
288
- /**
289
- * Renders a skeleton square in the `iconBefore` location.
290
- */
291
- hasIcon?: boolean;
292
- /**
293
- *
294
- * Width of the skeleton item.
295
- * Generally you don't need to specify this as it has a staggered width based on `:nth-child` by default.
296
- */
297
- width?: Dimension;
298
- /**
299
- * A `testId` prop is provided for specified elements,
300
- * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
301
- * serving as a hook for automated tests.
302
- */
303
- testId?: string;
304
- /**
305
- * Causes to the skeleton to have a slight horizontal shimmer.
306
- * Only use this when you want to bring more attention to the loading content.
307
- */
308
- isShimmering?: boolean;
309
- /**
310
- * A function that overrides the styles of this component.
311
- * It receives the current styles and returns a customized styles object.
312
- */
313
- cssFn?: StatelessCSSFn;
314
- }
315
- export interface HeadingItemProps {
316
- /**
317
- A function that overrides the styles.
318
- It receives the current styles and returns a customized styles object.
319
-
320
- @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
321
- */
322
- cssFn?: StatelessCSSFn;
323
- /**
324
- * The text of the heading.
325
- */
326
- children: React.ReactNode;
327
- /**
328
- * A unique identifier that can be referenced in the `labelledby` prop of a
329
- * section to allow screen readers to announce the name of groups.
330
- */
331
- id?: string;
332
- /**
333
- * A `testId` prop is provided for specified elements,
334
- * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
335
- * serving as a hook for automated tests.
336
- */
337
- testId?: string;
338
- }
339
- export interface SkeletonHeadingItemProps {
340
- /**
341
- *
342
- * Width of the skeleton heading item.
343
- * Generally you don't need to specify this as it has a staggered width based on `:nth-child` by default.
344
- */
345
- width?: Dimension;
346
- /**
347
- * A `testId` prop is provided for specified elements,
348
- * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
349
- * serving as a hook for automated tests.
350
- */
351
- testId?: string;
352
- /**
353
- * Causes to the skeleton to have a slight horizontal shimmer.
354
- * Only use this when you want to bring more attention to the loading content.
355
- */
356
- isShimmering?: boolean;
357
- /**
358
- A function that overrides the styles of this component.
359
- It receives the current styles and returns a customized styles object.
360
-
361
- @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
362
- */
363
- cssFn?: StatelessCSSFn;
364
- }
365
- export declare type ItemState = {
366
- isSelected: boolean;
367
- isDisabled: boolean;
368
- };
369
- /**
370
- A function that overrides the styles of
371
- menu components. It receives the current state
372
- and should return a CSSObject.
373
-
374
- @see @atlaskit/menu/docs/85-overriding-item-styles
375
- @deprecated This type is deprecated and will be removed in a future release. See DSP-2676 for more information.
376
- */
377
- export interface CSSFn<TState = ItemState extends void ? void : ItemState> {
378
- (currentState: TState): CSSObject | CSSObject[];
379
- }
380
- /**
381
- * @deprecated This type is deprecated and will be removed in a future release. See DSP-2676 for more information.
382
- */
383
- export declare type StatelessCSSFn = CSSFn<void>;