@atlaskit/menu 2.0.0 → 2.1.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.
- package/CHANGELOG.md +12 -0
- package/codemods/2.1.0-invalid-link-item-to-button-item.tsx +208 -0
- package/codemods/__tests__/next-invalid-link-item-to-button-item.tsx +308 -0
- package/dist/cjs/internal/components/menu-item-primitive.js +22 -30
- package/dist/cjs/menu-item/button-item.js +2 -1
- package/dist/cjs/menu-item/custom-item.js +2 -1
- package/dist/cjs/menu-item/link-item.js +2 -1
- package/dist/es2019/internal/components/menu-item-primitive.js +22 -30
- package/dist/es2019/menu-item/button-item.js +2 -1
- package/dist/es2019/menu-item/custom-item.js +2 -1
- package/dist/es2019/menu-item/link-item.js +2 -1
- package/dist/esm/internal/components/menu-item-primitive.js +22 -30
- package/dist/esm/menu-item/button-item.js +2 -1
- package/dist/esm/menu-item/custom-item.js +2 -1
- package/dist/esm/menu-item/link-item.js +2 -1
- package/dist/types/internal/components/menu-item-primitive.d.ts +1 -1
- package/dist/types/types.d.ts +1 -0
- package/dist/types-ts4.5/entry-points/menu-item/button-item.d.ts +1 -0
- package/dist/types-ts4.5/entry-points/menu-item/custom-item.d.ts +1 -0
- package/dist/types-ts4.5/entry-points/menu-item/heading-item.d.ts +1 -0
- package/dist/types-ts4.5/entry-points/menu-item/link-item.d.ts +1 -0
- package/dist/types-ts4.5/entry-points/menu-item/skeleton-heading-item.d.ts +1 -0
- package/dist/types-ts4.5/entry-points/menu-item/skeleton-item.d.ts +1 -0
- package/dist/types-ts4.5/entry-points/menu-section/menu-group.d.ts +1 -0
- package/dist/types-ts4.5/entry-points/menu-section/popup-menu-group.d.ts +1 -0
- package/dist/types-ts4.5/entry-points/menu-section/section.d.ts +1 -0
- package/dist/types-ts4.5/index.d.ts +11 -0
- package/dist/types-ts4.5/internal/components/menu-context.d.ts +18 -0
- package/dist/types-ts4.5/internal/components/menu-item-primitive.d.ts +18 -0
- package/dist/types-ts4.5/internal/components/skeleton-shimmer.d.ts +24 -0
- package/dist/types-ts4.5/menu-item/button-item.d.ts +12 -0
- package/dist/types-ts4.5/menu-item/custom-item.d.ts +18 -0
- package/dist/types-ts4.5/menu-item/heading-item.d.ts +13 -0
- package/dist/types-ts4.5/menu-item/link-item.d.ts +12 -0
- package/dist/types-ts4.5/menu-item/skeleton-heading-item.d.ts +12 -0
- package/dist/types-ts4.5/menu-item/skeleton-item.d.ts +12 -0
- package/dist/types-ts4.5/menu-section/menu-group.d.ts +13 -0
- package/dist/types-ts4.5/menu-section/popup-menu-group.d.ts +8 -0
- package/dist/types-ts4.5/menu-section/section.d.ts +12 -0
- package/dist/types-ts4.5/types.d.ts +397 -0
- package/package.json +2 -2
- package/tmp/api-report-tmp.d.ts +222 -0
|
@@ -0,0 +1,397 @@
|
|
|
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
|
+
testId?: string;
|
|
141
|
+
}
|
|
142
|
+
export interface MenuItemProps {
|
|
143
|
+
/**
|
|
144
|
+
A function that overrides the styles of the component.
|
|
145
|
+
It receives the current styles and state and expects a styles object.
|
|
146
|
+
|
|
147
|
+
@deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
|
|
148
|
+
*/
|
|
149
|
+
cssFn?: CSSFn;
|
|
150
|
+
/**
|
|
151
|
+
* Element to render before the item text.
|
|
152
|
+
* Generally should be an [icon](https://atlaskit.atlassian.com/packages/design-system/icon) component.
|
|
153
|
+
*/
|
|
154
|
+
iconBefore?: React.ReactNode;
|
|
155
|
+
/**
|
|
156
|
+
* Element to render after the item text.
|
|
157
|
+
* Generally should be an [icon](https://atlaskit.atlassian.com/packages/design-system/icon) component.
|
|
158
|
+
*/
|
|
159
|
+
iconAfter?: React.ReactNode;
|
|
160
|
+
/**
|
|
161
|
+
* Event that is triggered when the element is clicked.
|
|
162
|
+
*/
|
|
163
|
+
onClick?: (event: React.MouseEvent | React.KeyboardEvent) => void;
|
|
164
|
+
/**
|
|
165
|
+
* Event that is triggered when the element has been pressed.
|
|
166
|
+
*/
|
|
167
|
+
onMouseDown?: React.MouseEventHandler;
|
|
168
|
+
/**
|
|
169
|
+
* Description of the item.
|
|
170
|
+
* This will render smaller text below the primary text of the item as well as slightly increasing the height of the item.
|
|
171
|
+
*/
|
|
172
|
+
description?: string | JSX.Element;
|
|
173
|
+
/**
|
|
174
|
+
* Makes the element appear disabled as well as removing interactivity.
|
|
175
|
+
*/
|
|
176
|
+
isDisabled?: boolean;
|
|
177
|
+
/**
|
|
178
|
+
* Makes the element appear selected.
|
|
179
|
+
*/
|
|
180
|
+
isSelected?: boolean;
|
|
181
|
+
/**
|
|
182
|
+
* Primary content for the item.
|
|
183
|
+
*/
|
|
184
|
+
children?: React.ReactNode;
|
|
185
|
+
/**
|
|
186
|
+
* A `testId` prop is provided for specified elements,
|
|
187
|
+
* which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
188
|
+
* serving as a hook for automated tests.
|
|
189
|
+
*/
|
|
190
|
+
testId?: string;
|
|
191
|
+
/**
|
|
192
|
+
Custom overrides for the composed components.
|
|
193
|
+
|
|
194
|
+
@deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
|
|
195
|
+
*/
|
|
196
|
+
overrides?: Overrides;
|
|
197
|
+
/**
|
|
198
|
+
* When `true` the title of the item will wrap multiple lines if it's long enough.
|
|
199
|
+
*/
|
|
200
|
+
shouldTitleWrap?: boolean;
|
|
201
|
+
/**
|
|
202
|
+
* When `true` the description of the item will wrap multiple lines if it's long enough.
|
|
203
|
+
*/
|
|
204
|
+
shouldDescriptionWrap?: boolean;
|
|
205
|
+
}
|
|
206
|
+
export interface ButtonItemProps extends MenuItemProps {
|
|
207
|
+
/**
|
|
208
|
+
* Unique identifier for the element.
|
|
209
|
+
*/
|
|
210
|
+
id?: string;
|
|
211
|
+
/**
|
|
212
|
+
* Used to override the accessibility role for the element.
|
|
213
|
+
*/
|
|
214
|
+
role?: string;
|
|
215
|
+
}
|
|
216
|
+
export interface LinkItemProps extends MenuItemProps {
|
|
217
|
+
/**
|
|
218
|
+
* Link to another page.
|
|
219
|
+
*/
|
|
220
|
+
href?: string;
|
|
221
|
+
/**
|
|
222
|
+
* Where to display the linked URL,
|
|
223
|
+
* see [anchor information](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a) on mdn for more information.
|
|
224
|
+
*/
|
|
225
|
+
target?: string;
|
|
226
|
+
/**
|
|
227
|
+
* The relationship of the linked URL as space-separated link types.
|
|
228
|
+
* Generally you'll want to set this to "noopener noreferrer" when `target` is "_blank".
|
|
229
|
+
*/
|
|
230
|
+
rel?: string;
|
|
231
|
+
/**
|
|
232
|
+
* Used to override the accessibility role for the element.
|
|
233
|
+
*/
|
|
234
|
+
role?: string;
|
|
235
|
+
}
|
|
236
|
+
export interface CustomItemComponentProps {
|
|
237
|
+
/**
|
|
238
|
+
* The children of the item.
|
|
239
|
+
*/
|
|
240
|
+
children: React.ReactNode;
|
|
241
|
+
/**
|
|
242
|
+
* Class to apply to the root container of the custom component,
|
|
243
|
+
* ensure this has been applied so the consistent item styling is applied.
|
|
244
|
+
*/
|
|
245
|
+
className: string;
|
|
246
|
+
/**
|
|
247
|
+
* Test id that is passed through to the custom component.
|
|
248
|
+
*/
|
|
249
|
+
'data-testid'?: string;
|
|
250
|
+
/**
|
|
251
|
+
* Event handler that is passed through to the custom component.
|
|
252
|
+
*/
|
|
253
|
+
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
254
|
+
/**
|
|
255
|
+
* Event handler that is passed through to the custom component.
|
|
256
|
+
*/
|
|
257
|
+
onMouseDown?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
258
|
+
/**
|
|
259
|
+
* Event handler that is passed through to the custom component.
|
|
260
|
+
* Used to disable the element from being draggable.
|
|
261
|
+
*/
|
|
262
|
+
onDragStart?: (event: React.DragEvent) => void;
|
|
263
|
+
/**
|
|
264
|
+
* Turns off the element being draggable.
|
|
265
|
+
*/
|
|
266
|
+
draggable: boolean;
|
|
267
|
+
/**
|
|
268
|
+
* React ref for the raw DOM element,
|
|
269
|
+
* make sure to place this on the outer most DOM element.
|
|
270
|
+
*/
|
|
271
|
+
ref?: Ref<any>;
|
|
272
|
+
/**
|
|
273
|
+
* Makes the element appear disabled as well as removing interactivity.
|
|
274
|
+
*/
|
|
275
|
+
tabIndex?: number;
|
|
276
|
+
/**
|
|
277
|
+
* Disabled attribute.
|
|
278
|
+
*/
|
|
279
|
+
disabled?: boolean;
|
|
280
|
+
}
|
|
281
|
+
export interface CustomItemProps<TCustomComponentProps = CustomItemComponentProps> extends MenuItemProps {
|
|
282
|
+
/**
|
|
283
|
+
Custom component to render as an item. This can be both a functional component or a class component.
|
|
284
|
+
|
|
285
|
+
__Will return `null` if no component is defined.__
|
|
286
|
+
|
|
287
|
+
Props passed to `CustomItem` will be passed down to this component. If the props for `component` have TypeScript types,
|
|
288
|
+
CustomItem will extend them, providing type safety for your custom item.
|
|
289
|
+
|
|
290
|
+
e.g. `<CustomItem to="/link" component={RouterLink} />`
|
|
291
|
+
|
|
292
|
+
__NOTE:__ Make sure the reference for this component does not change between renders else undefined behavior may happen.
|
|
293
|
+
*/
|
|
294
|
+
component?: React.ComponentType<TCustomComponentProps>;
|
|
295
|
+
}
|
|
296
|
+
export interface SkeletonItemProps {
|
|
297
|
+
/**
|
|
298
|
+
* Renders a skeleton circle in the `iconBefore` location.
|
|
299
|
+
* Takes priority over `hasIcon.
|
|
300
|
+
*/
|
|
301
|
+
hasAvatar?: boolean;
|
|
302
|
+
/**
|
|
303
|
+
* Renders a skeleton square in the `iconBefore` location.
|
|
304
|
+
*/
|
|
305
|
+
hasIcon?: boolean;
|
|
306
|
+
/**
|
|
307
|
+
*
|
|
308
|
+
* Width of the skeleton item.
|
|
309
|
+
* Generally you don't need to specify this as it has a staggered width based on `:nth-child` by default.
|
|
310
|
+
*/
|
|
311
|
+
width?: Dimension;
|
|
312
|
+
/**
|
|
313
|
+
* A `testId` prop is provided for specified elements,
|
|
314
|
+
* which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
315
|
+
* serving as a hook for automated tests.
|
|
316
|
+
*/
|
|
317
|
+
testId?: string;
|
|
318
|
+
/**
|
|
319
|
+
* Causes to the skeleton to have a slight horizontal shimmer.
|
|
320
|
+
* Only use this when you want to bring more attention to the loading content.
|
|
321
|
+
*/
|
|
322
|
+
isShimmering?: boolean;
|
|
323
|
+
/**
|
|
324
|
+
* A function that overrides the styles of this component.
|
|
325
|
+
* It receives the current styles and returns a customized styles object.
|
|
326
|
+
*/
|
|
327
|
+
cssFn?: StatelessCSSFn;
|
|
328
|
+
}
|
|
329
|
+
export interface HeadingItemProps {
|
|
330
|
+
/**
|
|
331
|
+
A function that overrides the styles.
|
|
332
|
+
It receives the current styles and returns a customized styles object.
|
|
333
|
+
|
|
334
|
+
@deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
|
|
335
|
+
*/
|
|
336
|
+
cssFn?: StatelessCSSFn;
|
|
337
|
+
/**
|
|
338
|
+
* The text of the heading.
|
|
339
|
+
*/
|
|
340
|
+
children: React.ReactNode;
|
|
341
|
+
/**
|
|
342
|
+
* A unique identifier that can be referenced in the `labelledby` prop of a
|
|
343
|
+
* section to allow screen readers to announce the name of groups.
|
|
344
|
+
*/
|
|
345
|
+
id?: string;
|
|
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
|
+
export interface SkeletonHeadingItemProps {
|
|
354
|
+
/**
|
|
355
|
+
*
|
|
356
|
+
* Width of the skeleton heading item.
|
|
357
|
+
* Generally you don't need to specify this as it has a staggered width based on `:nth-child` by default.
|
|
358
|
+
*/
|
|
359
|
+
width?: Dimension;
|
|
360
|
+
/**
|
|
361
|
+
* A `testId` prop is provided for specified elements,
|
|
362
|
+
* which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
363
|
+
* serving as a hook for automated tests.
|
|
364
|
+
*/
|
|
365
|
+
testId?: string;
|
|
366
|
+
/**
|
|
367
|
+
* Causes to the skeleton to have a slight horizontal shimmer.
|
|
368
|
+
* Only use this when you want to bring more attention to the loading content.
|
|
369
|
+
*/
|
|
370
|
+
isShimmering?: boolean;
|
|
371
|
+
/**
|
|
372
|
+
A function that overrides the styles of this component.
|
|
373
|
+
It receives the current styles and returns a customized styles object.
|
|
374
|
+
|
|
375
|
+
@deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
|
|
376
|
+
*/
|
|
377
|
+
cssFn?: StatelessCSSFn;
|
|
378
|
+
}
|
|
379
|
+
export type ItemState = {
|
|
380
|
+
isSelected: boolean;
|
|
381
|
+
isDisabled: boolean;
|
|
382
|
+
};
|
|
383
|
+
/**
|
|
384
|
+
A function that overrides the styles of
|
|
385
|
+
menu components. It receives the current state
|
|
386
|
+
and should return a CSSObject.
|
|
387
|
+
|
|
388
|
+
@see @atlaskit/menu/docs/85-overriding-item-styles
|
|
389
|
+
@deprecated This type is deprecated and will be removed in a future release. See DSP-2676 for more information.
|
|
390
|
+
*/
|
|
391
|
+
export interface CSSFn<TState = ItemState extends void ? void : ItemState> {
|
|
392
|
+
(currentState: TState): CSSObject | CSSObject[];
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* @deprecated This type is deprecated and will be removed in a future release. See DSP-2676 for more information.
|
|
396
|
+
*/
|
|
397
|
+
export type StatelessCSSFn = CSSFn<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/menu",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.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/"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
32
32
|
"@atlaskit/primitives": "^1.6.0",
|
|
33
33
|
"@atlaskit/theme": "^12.6.0",
|
|
34
|
-
"@atlaskit/tokens": "^1.
|
|
34
|
+
"@atlaskit/tokens": "^1.27.0",
|
|
35
35
|
"@babel/runtime": "^7.0.0",
|
|
36
36
|
"@emotion/react": "^11.7.1"
|
|
37
37
|
},
|
|
@@ -0,0 +1,222 @@
|
|
|
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
|
+
```
|