@atlaskit/side-navigation 1.2.14 → 1.3.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 (62) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/components/LoadingItems/index.js +3 -3
  3. package/dist/cjs/components/NavigationContent/index.js +4 -4
  4. package/dist/cjs/components/NavigationFooter/index.js +2 -2
  5. package/dist/cjs/components/NavigationHeader/index.js +2 -2
  6. package/dist/cjs/components/NestableNavigationContent/index.js +7 -7
  7. package/dist/cjs/components/NestableNavigationContent/nesting-motion.js +2 -2
  8. package/dist/cjs/components/NestingItem/index.js +9 -9
  9. package/dist/cjs/components/SideNavigation/index.js +2 -2
  10. package/dist/cjs/version.json +1 -1
  11. package/dist/es2019/components/LoadingItems/index.js +1 -1
  12. package/dist/es2019/components/NavigationContent/index.js +1 -1
  13. package/dist/es2019/components/NavigationFooter/index.js +1 -1
  14. package/dist/es2019/components/NavigationHeader/index.js +1 -1
  15. package/dist/es2019/components/NestableNavigationContent/index.js +1 -1
  16. package/dist/es2019/components/NestableNavigationContent/nesting-motion.js +1 -1
  17. package/dist/es2019/components/NestingItem/index.js +1 -1
  18. package/dist/es2019/components/SideNavigation/index.js +1 -1
  19. package/dist/es2019/version.json +1 -1
  20. package/dist/esm/components/LoadingItems/index.js +1 -1
  21. package/dist/esm/components/NavigationContent/index.js +1 -1
  22. package/dist/esm/components/NavigationFooter/index.js +1 -1
  23. package/dist/esm/components/NavigationHeader/index.js +1 -1
  24. package/dist/esm/components/NestableNavigationContent/index.js +1 -1
  25. package/dist/esm/components/NestableNavigationContent/nesting-motion.js +1 -1
  26. package/dist/esm/components/NestingItem/index.js +1 -1
  27. package/dist/esm/components/SideNavigation/index.js +1 -1
  28. package/dist/esm/version.json +1 -1
  29. package/dist/types/components/NavigationFooter/index.d.ts +2 -1
  30. package/dist/types/components/NavigationHeader/index.d.ts +3 -1
  31. package/dist/types/components/NestableNavigationContent/index.d.ts +2 -1
  32. package/dist/types/components/NestableNavigationContent/nesting-motion.d.ts +2 -1
  33. package/dist/types-ts4.0/common/constants.d.ts +2 -0
  34. package/dist/types-ts4.0/common/styles.d.ts +12 -0
  35. package/dist/types-ts4.0/components/Footer/index.d.ts +11 -0
  36. package/dist/types-ts4.0/components/Header/index.d.ts +50 -0
  37. package/dist/types-ts4.0/components/Item/button-item.d.ts +14 -0
  38. package/dist/types-ts4.0/components/Item/custom-item.d.ts +14 -0
  39. package/dist/types-ts4.0/components/Item/go-back-item.d.ts +14 -0
  40. package/dist/types-ts4.0/components/Item/index.d.ts +10 -0
  41. package/dist/types-ts4.0/components/Item/link-item.d.ts +16 -0
  42. package/dist/types-ts4.0/components/Item/skeleton-item.d.ts +13 -0
  43. package/dist/types-ts4.0/components/LoadingItems/index.d.ts +35 -0
  44. package/dist/types-ts4.0/components/NavigationContent/index.d.ts +25 -0
  45. package/dist/types-ts4.0/components/NavigationContent/styles.d.ts +91 -0
  46. package/dist/types-ts4.0/components/NavigationFooter/index.d.ts +16 -0
  47. package/dist/types-ts4.0/components/NavigationHeader/index.d.ts +16 -0
  48. package/dist/types-ts4.0/components/NestableNavigationContent/context.d.ts +23 -0
  49. package/dist/types-ts4.0/components/NestableNavigationContent/index.d.ts +69 -0
  50. package/dist/types-ts4.0/components/NestableNavigationContent/nesting-motion.d.ts +22 -0
  51. package/dist/types-ts4.0/components/NestingItem/hack-for-ert.d.ts +2 -0
  52. package/dist/types-ts4.0/components/NestingItem/index.d.ts +91 -0
  53. package/dist/types-ts4.0/components/NestingItem/styles.d.ts +28 -0
  54. package/dist/types-ts4.0/components/Section/heading-item.d.ts +11 -0
  55. package/dist/types-ts4.0/components/Section/index.d.ts +6 -0
  56. package/dist/types-ts4.0/components/Section/section.d.ts +34 -0
  57. package/dist/types-ts4.0/components/Section/skeleton-heading-item.d.ts +12 -0
  58. package/dist/types-ts4.0/components/SideNavigation/index.d.ts +32 -0
  59. package/dist/types-ts4.0/components/index.d.ts +22 -0
  60. package/dist/types-ts4.0/index.d.ts +4 -0
  61. package/package.json +17 -10
  62. package/report.api.md +163 -43
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/side-navigation",
3
- "version": "1.2.14",
3
+ "version": "1.3.0",
4
4
  "description": "A highly composable side navigation component that supports nested views.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -12,6 +12,13 @@
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
+ ]
20
+ }
21
+ },
15
22
  "sideEffects": false,
16
23
  "atlaskit:src": "src/index.tsx",
17
24
  "atlassian": {
@@ -25,13 +32,13 @@
25
32
  },
26
33
  "dependencies": {
27
34
  "@atlaskit/ds-lib": "^2.1.0",
28
- "@atlaskit/icon": "^21.10.0",
35
+ "@atlaskit/icon": "^21.11.0",
29
36
  "@atlaskit/menu": "^1.3.0",
30
37
  "@atlaskit/motion": "^1.2.0",
31
- "@atlaskit/theme": "^12.1.0",
38
+ "@atlaskit/theme": "^12.2.0",
32
39
  "@atlaskit/tokens": "^0.10.0",
33
40
  "@babel/runtime": "^7.0.0",
34
- "@emotion/core": "^10.0.9"
41
+ "@emotion/react": "^11.7.1"
35
42
  },
36
43
  "peerDependencies": {
37
44
  "react": "^16.8.0"
@@ -40,14 +47,14 @@
40
47
  "@atlaskit/atlassian-navigation": "^2.2.0",
41
48
  "@atlaskit/button": "^16.3.0",
42
49
  "@atlaskit/docs": "*",
43
- "@atlaskit/logo": "^13.8.0",
44
- "@atlaskit/onboarding": "^10.5.0",
45
- "@atlaskit/section-message": "^6.0.0",
46
- "@atlaskit/select": "^15.6.0",
50
+ "@atlaskit/logo": "^13.10.0",
51
+ "@atlaskit/onboarding": "^10.6.0",
52
+ "@atlaskit/section-message": "^6.3.0",
53
+ "@atlaskit/select": "^15.7.0",
47
54
  "@atlaskit/visual-regression": "*",
48
55
  "@atlaskit/webdriver-runner": "*",
49
56
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
50
- "@testing-library/react": "^8.0.1",
57
+ "@testing-library/react": "^12.1.5",
51
58
  "@types/jest-axe": "^3.5.0",
52
59
  "ast-types": "^0.13.3",
53
60
  "jest-axe": "^4.0.0",
@@ -55,7 +62,7 @@
55
62
  "jscodeshift": "^0.13.0",
56
63
  "raf-stub": "^2.0.1",
57
64
  "react-beautiful-dnd": "^12.1.1",
58
- "typescript": "4.3.5"
65
+ "typescript": "4.5.5"
59
66
  },
60
67
  "techstack": {
61
68
  "@atlassian/frontend": {
package/report.api.md CHANGED
@@ -1,6 +1,8 @@
1
- ## API Report File for "@atlaskit/side-navigation"
1
+ ## API Report File for "@atlaskit/side-navigation".
2
2
 
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
3
+ > Do not edit this file. This report is auto-generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
4
6
 
5
7
  ```ts
6
8
  /// <reference types="react" />
@@ -12,6 +14,7 @@ import { CustomItemProps } from '@atlaskit/menu';
12
14
  import { ForwardRefExoticComponent } from 'react';
13
15
  import { HeadingItemProps } from '@atlaskit/menu';
14
16
  import { HTMLAttributes } from 'react';
17
+ import { jsx } from '@emotion/react';
15
18
  import { LinkItemProps } from '@atlaskit/menu';
16
19
  import { Overrides } from '@atlaskit/menu';
17
20
  import { default as React_2 } from 'react';
@@ -20,6 +23,15 @@ import { RefAttributes } from 'react';
20
23
  import { SkeletonHeadingItemProps } from '@atlaskit/menu';
21
24
  import { SkeletonItemProps } from '@atlaskit/menu';
22
25
 
26
+ /**
27
+ * __Button item__
28
+ *
29
+ * A button item renders an item wrapped in a button tag, used primarily when an
30
+ * action does something other than changing routes.
31
+ *
32
+ * - [Examples](https://atlassian.design/components/side-navigation/examples#button-item)
33
+ * - [Code](https://atlassian.design/components/side-navigation/code)
34
+ */
23
35
  export declare const ButtonItem: React_2.ForwardRefExoticComponent<
24
36
  ButtonItemProps & React_2.RefAttributes<HTMLElement>
25
37
  >;
@@ -31,13 +43,13 @@ export { ButtonItemProps as GoBackItemProps };
31
43
  * Used to support any custom items needed by products alongside the Header and Footer patterns.
32
44
  * Specific implementation of headers and footers are provided in the examples folder.
33
45
  */
34
- export declare const CustomItem: CustomItemType;
46
+ export declare const CustomItem: CustomItemPropsHack;
35
47
 
36
48
  export { CustomItemComponentProps };
37
49
 
38
50
  export { CustomItemProps };
39
51
 
40
- declare interface CustomItemType {
52
+ declare interface CustomItemPropsHack {
41
53
  <TComponentProps extends {}>(
42
54
  props: CustomItemProps<TComponentProps> & {
43
55
  ref?: any;
@@ -45,12 +57,33 @@ declare interface CustomItemType {
45
57
  ): JSX.Element | null;
46
58
  }
47
59
 
60
+ /**
61
+ * __Header__
62
+ *
63
+ * - [Examples](https://atlassian.design/components/side-navigation/examples#header-and-footer)
64
+ * - [Code](https://atlassian.design/components/side-navigation/code)
65
+ */
48
66
  export declare const Footer: (props: HeaderProps) => JSX.Element;
49
67
 
68
+ /**
69
+ * __Go back item__
70
+ *
71
+ * A go back item is used to provide a customized "go back" button in nested
72
+ * navigations.
73
+ *
74
+ * - [Examples](https://atlassian.design/components/side-navigation/examples#go-back-item)
75
+ * - [Code](https://atlassian.design/components/side-navigation/code)
76
+ */
50
77
  export declare const GoBackItem: React_2.ForwardRefExoticComponent<
51
78
  ButtonItemProps & React_2.RefAttributes<HTMLElement>
52
79
  >;
53
80
 
81
+ /**
82
+ * __Header__
83
+ *
84
+ * - [Examples](https://atlassian.design/components/side-navigation/examples#header-and-footer)
85
+ * - [Code](https://atlassian.design/components/side-navigation/code)
86
+ */
54
87
  export declare const Header: React_2.ForwardRefExoticComponent<
55
88
  HeaderProps & React_2.RefAttributes<HTMLElement>
56
89
  >;
@@ -87,29 +120,51 @@ declare interface HeaderProps {
87
120
  */
88
121
  testId?: string;
89
122
  /**
90
- * Custom component to render as an item.
91
- * This can be both a functional component or a class component.
92
- * **Will return `null` if no component is defined.**
93
-
94
- * **NOTE:** Make sure the reference for this component does not change between renders else undefined behavior may happen.
95
- */
123
+ * Custom component to render as an item.
124
+ * This can be both a functional component or a class component.
125
+ * __Will return `null` if no component is defined.__
126
+ *
127
+ * __NOTE:__ Make sure the reference for this component does not change between renders else undefined behavior may happen.
128
+ */
96
129
  component?: React_2.ComponentType<CustomItemComponentProps>;
97
130
  }
98
131
  export { HeaderProps as FooterProps };
99
132
  export { HeaderProps };
100
133
 
134
+ /**
135
+ * __Heading item__
136
+ *
137
+ * Available for advanced use cases, for most situations providing a title to Section should be enough.
138
+ *
139
+ */
101
140
  export declare const HeadingItem: (
102
141
  props: HeadingItemProps,
103
142
  ) => JSX.Element | null;
104
143
 
105
144
  export { HeadingItemProps };
106
145
 
146
+ /**
147
+ * __Link item__
148
+ *
149
+ * Renders an item wrapped in an anchor tag, useful when you have an item that
150
+ * should change routes using native browser navigation. For SPA transitions use
151
+ * a [custom item](https://atlassian.design/components/side-navigation/examples#custom-item)
152
+ * with the respective router logic.
153
+ *
154
+ * - [Examples](https://atlassian.design/components/side-navigation/examples#link-item)
155
+ * - [Code](https://atlassian.design/components/side-navigation/code)
156
+ */
107
157
  export declare const LinkItem: React_2.ForwardRefExoticComponent<
108
158
  LinkItemProps & React_2.RefAttributes<HTMLElement>
109
159
  >;
110
160
 
111
161
  export { LinkItemProps };
112
162
 
163
+ /**
164
+ * __Loading items__
165
+ *
166
+ * Loading items conditionally render based on the useShouldNestedElementRender() hook.
167
+ */
113
168
  export declare const LoadingItems: ({
114
169
  children,
115
170
  isLoading,
@@ -134,17 +189,25 @@ export declare interface LoadingItemsProps {
134
189
  */
135
190
  isLoading?: boolean;
136
191
  /**
137
- * A `testId` prop is provided for specified elements,
138
- * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
139
- * serving as a hook for automated tests.
140
-
141
- * Will set these elements when defined:
142
- * - The entering container - `{testId}--entering`
143
- * - The exiting container - `{testId}--exiting`
144
- */
192
+ * A `testId` prop is provided for specified elements,
193
+ * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
194
+ * serving as a hook for automated tests.
195
+ *
196
+ * Will set these elements when defined:
197
+ * - The entering container - `{testId}--entering`
198
+ * - The exiting container - `{testId}--exiting`
199
+ */
145
200
  testId?: string;
146
201
  }
147
202
 
203
+ /**
204
+ * __Navigation content__
205
+ *
206
+ * A navigation content is used as the container for navigation items.
207
+ *
208
+ * - [Examples](https://atlassian.design/components/side-navigation/examples#content)
209
+ * - [Code](https://atlassian.design/components/side-navigation/code)
210
+ */
148
211
  export declare const NavigationContent: ForwardRefExoticComponent<
149
212
  NavigationContentProps &
150
213
  HTMLAttributes<HTMLElement> &
@@ -165,25 +228,49 @@ export declare interface NavigationContentProps {
165
228
  testId?: string;
166
229
  }
167
230
 
231
+ /**
232
+ * __Navigation footer__
233
+ *
234
+ * Allows for customisation of the footer.
235
+ *
236
+ * - [Examples](https://atlassian.design/components/side-navigation/examples#header-and-footer)
237
+ * - [Code](https://atlassian.design/components/side-navigation/code)
238
+ */
168
239
  export declare const NavigationFooter: ({
169
240
  children,
170
- }: NavigationFooterProps) => JSX.Element;
241
+ }: NavigationFooterProps) => jsx.JSX.Element;
171
242
 
172
243
  export declare interface NavigationFooterProps {
173
244
  children: ReactNode;
174
245
  }
175
246
 
247
+ /**
248
+ * __Navigation header__
249
+ *
250
+ * Allows for customisation of the header.
251
+ *
252
+ * - [Examples](https://atlassian.design/components/side-navigation/examples#header-and-footer)
253
+ * - [Code](https://atlassian.design/components/side-navigation/code)
254
+ */
176
255
  export declare const NavigationHeader: (
177
256
  props: NavigationHeaderProps,
178
- ) => JSX.Element;
257
+ ) => jsx.JSX.Element;
179
258
 
180
259
  export declare interface NavigationHeaderProps {
181
260
  children: JSX.Element | JSX.Element[];
182
261
  }
183
262
 
263
+ /**
264
+ * __Nestable navigation content__
265
+ *
266
+ * The container for navigation items with nested views
267
+ *
268
+ * - [Examples](https://atlassian.design/components/side-navigation/examples#nested-navigation)
269
+ * - [Code](https://atlassian.design/components/side-navigation/code)
270
+ */
184
271
  export declare const NestableNavigationContent: (
185
272
  props: NestableNavigationContentProps,
186
- ) => JSX.Element;
273
+ ) => jsx.JSX.Element;
187
274
 
188
275
  export declare interface NestableNavigationContentProps {
189
276
  /**
@@ -193,14 +280,14 @@ export declare interface NestableNavigationContentProps {
193
280
  */
194
281
  children: JSX.Element | JSX.Element[];
195
282
  /**
196
- * A `testId` prop is provided for specified elements,
197
- * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
198
- * serving as a hook for automated tests.
199
-
200
- * Will set these elements when defined:
201
- * - This wrapper - `{testId}`
202
- * - The back item (displayed when inside a nested view) - `{testId}--go-back-item`
203
- */
283
+ * A `testId` prop is provided for specified elements,
284
+ * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
285
+ * serving as a hook for automated tests.
286
+ *
287
+ * Will set these elements when defined:
288
+ * - This wrapper - `{testId}`
289
+ * - The back item (displayed when inside a nested view) - `{testId}--go-back-item`
290
+ */
204
291
  testId?: string;
205
292
  /**
206
293
  * Array of the initial stack you want to show.
@@ -223,10 +310,10 @@ export declare interface NestableNavigationContentProps {
223
310
  */
224
311
  onChange?: (stack: string[]) => void;
225
312
  /**
226
- Custom overrides for the composed components.
227
-
228
- @deprecated Please avoid using this prop as we intend to remove the prop completely in a future release. See DSP-2682 for more information.
229
- */
313
+ * Custom overrides for the composed components.
314
+ *
315
+ * @deprecated Please avoid using this prop as we intend to remove the prop completely in a future release. See DSP-2682 for more information.
316
+ */
230
317
  overrides?: {
231
318
  /**
232
319
  * Use this to override the default back button displayed when navigation is nested.
@@ -288,16 +375,16 @@ export declare interface NestingItemProps<
288
375
  */
289
376
  component?: React_2.ComponentType<TCustomComponentProps>;
290
377
  /**
291
- * A `testId` prop is provided for specified elements,
292
- * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
293
- * serving as a hook for automated tests.
294
-
295
- * Will set these elements when defined:
296
- * - The container - `{testId}--container`
297
- * - The nesting item - `{testId}--item`
298
- * - The go back item - `{testId}--go-back-item` (only used if you pass in a override).
299
- * - The nesting item default right arrow icon - `{testId}--item--right-arrow`
300
- */
378
+ * A `testId` prop is provided for specified elements,
379
+ * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
380
+ * serving as a hook for automated tests.
381
+ *
382
+ * Will set these elements when defined:
383
+ * - The container - `{testId}--container`
384
+ * - The nesting item - `{testId}--item`
385
+ * - The go back item - `{testId}--go-back-item` (only used if you pass in a override).
386
+ * - The nesting item default right arrow icon - `{testId}--item--right-arrow`
387
+ */
301
388
  testId?: string;
302
389
  /**
303
390
  * A function that can be used to override the styles of the component.
@@ -337,6 +424,15 @@ export declare interface NestingItemProps<
337
424
  overrides?: NestingItemOverrides;
338
425
  }
339
426
 
427
+ /**
428
+ * __Section__
429
+ *
430
+ * Used to separate items into sections. Using the title prop makes a section
431
+ * implicitly group the items for screen readers with no additional work required.
432
+ *
433
+ * - [Examples](https://atlassian.design/components/side-navigation/examples#section)
434
+ * - [Code](https://atlassian.design/components/side-navigation/code)
435
+ */
340
436
  export declare const Section: React_2.ForwardRefExoticComponent<
341
437
  SectionProps & React_2.RefAttributes<HTMLElement>
342
438
  >;
@@ -364,6 +460,15 @@ export declare interface SectionProps {
364
460
  testId?: string;
365
461
  }
366
462
 
463
+ /**
464
+ * __Side navigation__
465
+ *
466
+ * A highly composable side navigation component that supports nested views.
467
+ *
468
+ * - [Examples](https://atlassian.design/components/side-navigation/examples)
469
+ * - [Code](https://atlassian.design/components/side-navigation/code)
470
+ * - [Usage](https://atlassian.design/components/side-navigation/usage)
471
+ */
367
472
  export declare const SideNavigation: ForwardRefExoticComponent<
368
473
  SideNavigationProps & RefAttributes<HTMLElement>
369
474
  >;
@@ -389,12 +494,27 @@ export declare interface SideNavigationProps {
389
494
  testId?: string;
390
495
  }
391
496
 
497
+ /**
498
+ * __Skeleton heading item__
499
+ *
500
+ * A skeleton heading item for use in managing loading states.
501
+ *
502
+ * - [Examples](https://atlassian.design/components/side-navigation/examples#loading)
503
+ */
392
504
  export declare const SkeletonHeadingItem: (
393
505
  props: SkeletonHeadingItemProps,
394
506
  ) => JSX.Element | null;
395
507
 
396
508
  export { SkeletonHeadingItemProps };
397
509
 
510
+ /**
511
+ * __Skeleton item__
512
+ *
513
+ * A skeleton item can be used to reduce the perceived laoding time.
514
+ *
515
+ * - [Examples](https://atlassian.design/components/side-navigation/examples#loading)
516
+ * - [Code](https://atlassian.design/components/side-navigation/code)
517
+ */
398
518
  export declare const SkeletonItem: (
399
519
  props: SkeletonItemProps,
400
520
  ) => JSX.Element | null;