@atlaskit/side-navigation 1.2.12 → 1.2.13

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 (100) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/codemods/{0.8.0-change-css-fn-prop.ts → 0.8.0-change-css-fn-prop.tsx} +0 -0
  3. package/codemods/__tests__/{0.8.0-change-css-fn-prop.ts → 0.8.0-change-css-fn-prop.tsx} +0 -0
  4. package/codemods/helpers/{generic.ts → generic.tsx} +0 -0
  5. package/dist/cjs/components/Footer/index.js +11 -2
  6. package/dist/cjs/components/Header/index.js +11 -2
  7. package/dist/cjs/components/Item/button-item.js +10 -1
  8. package/dist/cjs/components/Item/go-back-item.js +11 -1
  9. package/dist/cjs/components/Item/link-item.js +12 -1
  10. package/dist/cjs/components/Item/skeleton-item.js +11 -2
  11. package/dist/cjs/components/LoadingItems/index.js +6 -0
  12. package/dist/cjs/components/NavigationContent/index.js +9 -0
  13. package/dist/cjs/components/NavigationFooter/index.js +8 -0
  14. package/dist/cjs/components/NavigationHeader/index.js +9 -0
  15. package/dist/cjs/components/NestableNavigationContent/context.js +3 -0
  16. package/dist/cjs/components/NestableNavigationContent/index.js +8 -0
  17. package/dist/cjs/components/NestableNavigationContent/nesting-motion.js +3 -0
  18. package/dist/cjs/components/NestingItem/hack-for-ert.js +1 -0
  19. package/dist/cjs/components/Section/heading-item.js +7 -1
  20. package/dist/cjs/components/Section/section.js +11 -1
  21. package/dist/cjs/components/Section/skeleton-heading-item.js +10 -2
  22. package/dist/cjs/components/SideNavigation/index.js +10 -0
  23. package/dist/cjs/version.json +1 -1
  24. package/dist/es2019/components/Footer/index.js +11 -2
  25. package/dist/es2019/components/Header/index.js +11 -2
  26. package/dist/es2019/components/Item/button-item.js +11 -1
  27. package/dist/es2019/components/Item/custom-item.js +2 -0
  28. package/dist/es2019/components/Item/go-back-item.js +12 -1
  29. package/dist/es2019/components/Item/link-item.js +13 -1
  30. package/dist/es2019/components/Item/skeleton-item.js +11 -2
  31. package/dist/es2019/components/LoadingItems/index.js +5 -0
  32. package/dist/es2019/components/NavigationContent/index.js +9 -0
  33. package/dist/es2019/components/NavigationFooter/index.js +8 -0
  34. package/dist/es2019/components/NavigationHeader/index.js +8 -0
  35. package/dist/es2019/components/NestableNavigationContent/context.js +4 -0
  36. package/dist/es2019/components/NestableNavigationContent/index.js +8 -0
  37. package/dist/es2019/components/NestableNavigationContent/nesting-motion.js +4 -0
  38. package/dist/es2019/components/NestingItem/hack-for-ert.js +1 -0
  39. package/dist/es2019/components/Section/heading-item.js +7 -1
  40. package/dist/es2019/components/Section/section.js +11 -1
  41. package/dist/es2019/components/Section/skeleton-heading-item.js +10 -2
  42. package/dist/es2019/components/SideNavigation/index.js +10 -0
  43. package/dist/es2019/version.json +1 -1
  44. package/dist/esm/components/Footer/index.js +11 -2
  45. package/dist/esm/components/Header/index.js +11 -2
  46. package/dist/esm/components/Item/button-item.js +11 -1
  47. package/dist/esm/components/Item/custom-item.js +2 -0
  48. package/dist/esm/components/Item/go-back-item.js +12 -1
  49. package/dist/esm/components/Item/link-item.js +13 -1
  50. package/dist/esm/components/Item/skeleton-item.js +11 -2
  51. package/dist/esm/components/LoadingItems/index.js +5 -0
  52. package/dist/esm/components/NavigationContent/index.js +9 -0
  53. package/dist/esm/components/NavigationFooter/index.js +8 -0
  54. package/dist/esm/components/NavigationHeader/index.js +8 -0
  55. package/dist/esm/components/NestableNavigationContent/context.js +4 -0
  56. package/dist/esm/components/NestableNavigationContent/index.js +8 -0
  57. package/dist/esm/components/NestableNavigationContent/nesting-motion.js +4 -0
  58. package/dist/esm/components/NestingItem/hack-for-ert.js +1 -0
  59. package/dist/esm/components/Section/heading-item.js +7 -1
  60. package/dist/esm/components/Section/section.js +11 -1
  61. package/dist/esm/components/Section/skeleton-heading-item.js +10 -2
  62. package/dist/esm/components/SideNavigation/index.js +10 -0
  63. package/dist/esm/version.json +1 -1
  64. package/dist/types/components/Footer/index.d.ts +6 -0
  65. package/dist/types/components/Header/index.d.ts +9 -3
  66. package/dist/types/components/Item/button-item.d.ts +9 -0
  67. package/dist/types/components/Item/custom-item.d.ts +2 -2
  68. package/dist/types/components/Item/go-back-item.d.ts +9 -0
  69. package/dist/types/components/Item/link-item.d.ts +11 -0
  70. package/dist/types/components/Item/skeleton-item.d.ts +8 -0
  71. package/dist/types/components/LoadingItems/index.d.ts +6 -1
  72. package/dist/types/components/NavigationContent/index.d.ts +8 -0
  73. package/dist/types/components/NavigationFooter/index.d.ts +8 -0
  74. package/dist/types/components/NavigationHeader/index.d.ts +8 -0
  75. package/dist/types/components/NestableNavigationContent/context.d.ts +3 -0
  76. package/dist/types/components/NestableNavigationContent/index.d.ts +12 -4
  77. package/dist/types/components/NestableNavigationContent/nesting-motion.d.ts +3 -0
  78. package/dist/types/components/NestingItem/index.d.ts +1 -1
  79. package/dist/types/components/Section/heading-item.d.ts +6 -0
  80. package/dist/types/components/Section/section.d.ts +9 -0
  81. package/dist/types/components/Section/skeleton-heading-item.d.ts +7 -0
  82. package/dist/types/components/SideNavigation/index.d.ts +9 -0
  83. package/docs/00-intro.tsx +10 -65
  84. package/package.json +8 -7
  85. package/report.api.md +419 -0
  86. package/docs/01-side-navigation.tsx +0 -33
  87. package/docs/02-navigation-header.tsx +0 -39
  88. package/docs/03-navigation-content.tsx +0 -40
  89. package/docs/04-nestable-navigation-content.tsx +0 -95
  90. package/docs/05-navigation-footer.tsx +0 -38
  91. package/docs/99-loading-states.tsx +0 -95
  92. package/docs/button-item.tsx +0 -38
  93. package/docs/custom-item.tsx +0 -45
  94. package/docs/go-back-item.tsx +0 -31
  95. package/docs/heading-item.tsx +0 -30
  96. package/docs/link-item.tsx +0 -39
  97. package/docs/nesting-item.tsx +0 -52
  98. package/docs/section.tsx +0 -40
  99. package/docs/skeleton-heading-item.tsx +0 -30
  100. package/docs/skeleton-item.tsx +0 -30
package/report.api.md ADDED
@@ -0,0 +1,419 @@
1
+ ## API Report File for "@atlaskit/side-navigation"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+ /// <reference types="react" />
7
+
8
+ import { ButtonItemProps } from '@atlaskit/menu';
9
+ import { CSSFn } from '@atlaskit/menu';
10
+ import { CustomItemComponentProps } from '@atlaskit/menu';
11
+ import { CustomItemProps } from '@atlaskit/menu';
12
+ import { ForwardRefExoticComponent } from 'react';
13
+ import { HeadingItemProps } from '@atlaskit/menu';
14
+ import { HTMLAttributes } from 'react';
15
+ import { LinkItemProps } from '@atlaskit/menu';
16
+ import { Overrides } from '@atlaskit/menu';
17
+ import { default as React_2 } from 'react';
18
+ import { ReactNode } from 'react';
19
+ import { RefAttributes } from 'react';
20
+ import { SkeletonHeadingItemProps } from '@atlaskit/menu';
21
+ import { SkeletonItemProps } from '@atlaskit/menu';
22
+
23
+ export declare const ButtonItem: React_2.ForwardRefExoticComponent<
24
+ ButtonItemProps & React_2.RefAttributes<HTMLElement>
25
+ >;
26
+
27
+ export { ButtonItemProps };
28
+ export { ButtonItemProps as GoBackItemProps };
29
+
30
+ /**
31
+ * Used to support any custom items needed by products alongside the Header and Footer patterns.
32
+ * Specific implementation of headers and footers are provided in the examples folder.
33
+ */
34
+ export declare const CustomItem: CustomItemType;
35
+
36
+ export { CustomItemComponentProps };
37
+
38
+ export { CustomItemProps };
39
+
40
+ declare interface CustomItemType {
41
+ <TComponentProps extends {}>(
42
+ props: CustomItemProps<TComponentProps> & {
43
+ ref?: any;
44
+ } & Omit<TComponentProps, keyof CustomItemComponentProps>,
45
+ ): JSX.Element | null;
46
+ }
47
+
48
+ export declare const Footer: (props: HeaderProps) => JSX.Element;
49
+
50
+ export declare const GoBackItem: React_2.ForwardRefExoticComponent<
51
+ ButtonItemProps & React_2.RefAttributes<HTMLElement>
52
+ >;
53
+
54
+ export declare const Header: React_2.ForwardRefExoticComponent<
55
+ HeaderProps & React_2.RefAttributes<HTMLElement>
56
+ >;
57
+
58
+ declare interface HeaderProps {
59
+ /**
60
+ * A function that can be used to override the styles of the component.
61
+ * It receives the current styles and state and expects a styles object.
62
+ * @deprecated Please avoid using this prop as we intend to remove the prop completely in a future release. See DSP-2682 for more information.
63
+ */
64
+ cssFn?: CSSFn;
65
+ /**
66
+ * Element to render before the item text.
67
+ * Generally should be an [icon](https://atlaskit.atlassian.com/packages/design-system/icon) component.
68
+ */
69
+ iconBefore?: React_2.ReactNode;
70
+ /**
71
+ * Event that is triggered when the element is clicked.
72
+ */
73
+ onClick?: (event: React_2.MouseEvent | React_2.KeyboardEvent) => void;
74
+ /**
75
+ * Description of the item.
76
+ * This will render smaller text below the primary text of the item as well as slightly increasing the height of the item.
77
+ */
78
+ description?: string | JSX.Element;
79
+ /**
80
+ * Primary content for the item.
81
+ */
82
+ children?: React_2.ReactNode;
83
+ /**
84
+ * A `testId` prop is provided for specified elements,
85
+ * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
86
+ * serving as a hook for automated tests.
87
+ */
88
+ testId?: string;
89
+ /**
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
+ */
96
+ component?: React_2.ComponentType<CustomItemComponentProps>;
97
+ }
98
+ export { HeaderProps as FooterProps };
99
+ export { HeaderProps };
100
+
101
+ export declare const HeadingItem: (
102
+ props: HeadingItemProps,
103
+ ) => JSX.Element | null;
104
+
105
+ export { HeadingItemProps };
106
+
107
+ export declare const LinkItem: React_2.ForwardRefExoticComponent<
108
+ LinkItemProps & React_2.RefAttributes<HTMLElement>
109
+ >;
110
+
111
+ export { LinkItemProps };
112
+
113
+ export declare const LoadingItems: ({
114
+ children,
115
+ isLoading,
116
+ fallback,
117
+ testId,
118
+ }: LoadingItemsProps) => JSX.Element;
119
+
120
+ export declare interface LoadingItemsProps {
121
+ /**
122
+ * Child items that will be loaded asynchronously.
123
+ */
124
+ children: React.ReactNode;
125
+ /**
126
+ * Fallback you want to show when loading.
127
+ * You'll want to use the supplied [skeleton item](/packages/navigation/side-navigation/docs/skeleton-item)
128
+ * or [skeleton heading item](/packages/navigation/side-navigation/docs/skeleton-heading-item) components.
129
+ */
130
+ fallback: React.ReactNode;
131
+ /**
132
+ * Used to show either the loading fallback or the loaded contents.
133
+ * Will cross fade between children and fallback when this is flipped.
134
+ */
135
+ isLoading?: boolean;
136
+ /**
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
+ */
145
+ testId?: string;
146
+ }
147
+
148
+ export declare const NavigationContent: ForwardRefExoticComponent<
149
+ NavigationContentProps &
150
+ HTMLAttributes<HTMLElement> &
151
+ RefAttributes<HTMLElement>
152
+ >;
153
+
154
+ export declare interface NavigationContentProps {
155
+ children: React.ReactNode;
156
+ /**
157
+ * Forces the top scroll indicator to be shown all the time.
158
+ */
159
+ showTopScrollIndicator?: boolean;
160
+ /**
161
+ * A `testId` prop is provided for specified elements,
162
+ * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
163
+ * serving as a hook for automated tests.
164
+ */
165
+ testId?: string;
166
+ }
167
+
168
+ export declare const NavigationFooter: ({
169
+ children,
170
+ }: NavigationFooterProps) => JSX.Element;
171
+
172
+ export declare interface NavigationFooterProps {
173
+ children: ReactNode;
174
+ }
175
+
176
+ export declare const NavigationHeader: (
177
+ props: NavigationHeaderProps,
178
+ ) => JSX.Element;
179
+
180
+ export declare interface NavigationHeaderProps {
181
+ children: JSX.Element | JSX.Element[];
182
+ }
183
+
184
+ export declare const NestableNavigationContent: (
185
+ props: NestableNavigationContentProps,
186
+ ) => JSX.Element;
187
+
188
+ export declare interface NestableNavigationContentProps {
189
+ /**
190
+ * The NestableNavigationContent wraps the entire navigation hierarchy of a side-navigation.
191
+ * Using this component is only needed if you want to enable nested views with [nesting items](/packages/navigation/side-navigation/docs/nesting-item),
192
+ * else you should use [navigation content](/packages/navigation/side-navigation/docs/navigation-content) instead.
193
+ */
194
+ children: JSX.Element | JSX.Element[];
195
+ /**
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
+ */
204
+ testId?: string;
205
+ /**
206
+ * Array of the initial stack you want to show.
207
+ * Useful when wanting to set the initial nested view but not wanting to opt into controlled state.
208
+ * Make sure to have all intermediate navigation pages line up.
209
+ */
210
+ initialStack?: string[];
211
+ /**
212
+ * Enables you to control the stack of navigation views you want to show.
213
+ * Do not jump between controlled and uncontrolled else undefined behaviour will occur.
214
+ * This means either using `initialStack` OR `stack` but not both.
215
+ * Make sure your stack array has a stable reference and does not change between renders.
216
+ */
217
+ stack?: string[];
218
+ /**
219
+ * Allows you to react based on transitions between [nesting items](/packages/navigation/side-navigation/docs/nesting-item).
220
+ * It will be called everytime a user navigates from one [nesting item](/packages/navigation/side-navigation/docs/nesting-item) to another,
221
+ * both up or down the navigation hierarchy.
222
+ * This prop should be used with the `stack` prop for controlled behavior.
223
+ */
224
+ onChange?: (stack: string[]) => void;
225
+ /**
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
+ */
230
+ overrides?: {
231
+ /**
232
+ * Use this to override the default back button displayed when navigation is nested.
233
+ * You'll want to import the [go back item](/packages/navigation/docs/go-back-item) component and use it here.
234
+ * This will be displayed for all children [nesting items](/packages/navigation/side-navigation/docs/nesting-item) unless they define their own.
235
+ */
236
+ GoBackItem?: {
237
+ render?: (props: {
238
+ onClick: () => void;
239
+ testId?: string;
240
+ }) => React.ReactNode;
241
+ };
242
+ };
243
+ }
244
+
245
+ /**
246
+ * NestingItem will render itself differently depending in what context it is rendered in.
247
+ * When not open - it will render itself as an item.
248
+ * When open - it will render its children.
249
+ */
250
+ export declare const NestingItem: <TCustomComponentProps extends CustomItemComponentProps>(
251
+ props: NestingItemProps<TCustomComponentProps> &
252
+ Omit<TCustomComponentProps, keyof CustomItemComponentProps>,
253
+ ) => JSX.Element;
254
+
255
+ declare interface NestingItemOverrides extends Overrides {
256
+ /**
257
+ * Use this to override the back button displayed when navigation is nested.
258
+ * You'll want to import the [go back item](/packages/navigation/side-navigation/docs/go-back-item) component and use it here.
259
+ * This will be displayed for all children nesting item components unless they define their own.
260
+ */
261
+ GoBackItem?: {
262
+ render?: (props: {
263
+ onClick: () => void;
264
+ testId?: string;
265
+ }) => React_2.ReactNode;
266
+ };
267
+ }
268
+
269
+ export declare interface NestingItemProps<
270
+ TCustomComponentProps = CustomItemComponentProps
271
+ > {
272
+ /**
273
+ * A **unique identifier** for the nesting item.
274
+ * Every nesting item component needs a unique id else undefined behavior will occur.
275
+ */
276
+ id: string;
277
+ /**
278
+ * Text to display when the nesting item is rendered as a interactable element.
279
+ */
280
+ title: React_2.ReactNode;
281
+ /**
282
+ * The view that should be shown when this nesting item is visible.
283
+ */
284
+ children: React_2.ReactNode;
285
+ /**
286
+ * Used to customize the rendered component when shown as an item.
287
+ * You can use this for example to change it to a SPA link.
288
+ */
289
+ component?: React_2.ComponentType<TCustomComponentProps>;
290
+ /**
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
+ */
301
+ testId?: string;
302
+ /**
303
+ * A function that can be used to override the styles of the component.
304
+ * It receives the current styles and state and expects a styles object.
305
+ */
306
+ cssFn?: CSSFn;
307
+ /**
308
+ * Element to render before the item text.
309
+ * Generally should be an [icon](https://atlaskit.atlassian.com/packages/design-system/icon) component.
310
+ */
311
+ iconBefore?: React_2.ReactNode;
312
+ /**
313
+ * Element to render after the item text.
314
+ * Generally should be an [icon](https://atlaskit.atlassian.com/packages/design-system/icon) component.
315
+ */
316
+ iconAfter?: React_2.ReactNode;
317
+ /**
318
+ * Event that is triggered when the element is clicked.
319
+ */
320
+ onClick?: (event: React_2.MouseEvent | React_2.KeyboardEvent) => void;
321
+ /**
322
+ * Description of the item.
323
+ * This will render smaller text below the primary text of the item as well as slightly increasing the height of the item.
324
+ */
325
+ description?: string | JSX.Element;
326
+ /**
327
+ * Makes the element appear disabled as well as removing interactivity.
328
+ */
329
+ isDisabled?: boolean;
330
+ /**
331
+ * Makes the element appear selected.
332
+ */
333
+ isSelected?: boolean;
334
+ /**
335
+ * Custom overrides for the composed components.
336
+ */
337
+ overrides?: NestingItemOverrides;
338
+ }
339
+
340
+ export declare const Section: React_2.ForwardRefExoticComponent<
341
+ SectionProps & React_2.RefAttributes<HTMLElement>
342
+ >;
343
+
344
+ export declare interface SectionProps {
345
+ /**
346
+ * Children of the section,
347
+ * should generally be item or heading components.
348
+ */
349
+ children: React_2.ReactNode;
350
+ /**
351
+ * The text passed to heading.
352
+ * If a title is not provided no heading will be rendered.
353
+ */
354
+ title?: string;
355
+ /**
356
+ * Will render a border at the top of the section.
357
+ */
358
+ hasSeparator?: boolean;
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
+
367
+ export declare const SideNavigation: ForwardRefExoticComponent<
368
+ SideNavigationProps & RefAttributes<HTMLElement>
369
+ >;
370
+
371
+ export declare interface SideNavigationProps {
372
+ /**
373
+ * Describes the specific role of this navigation component for users viewing the page with a screen reader.
374
+ * Differentiates from other navigation components on a page.
375
+ */
376
+ label: string;
377
+ /**
378
+ * Child navigation elements.
379
+ * You'll want to compose children from [navigation header](/packages/navigation/side-navigation/docs/navigation-header),
380
+ * [navigation content](/packages/navigation/side-navigation/docs/navigation-content) or [nestable navigation content](/packages/navigation/side-navigation/docs/nestable-navigation-content),
381
+ * and [navigation footer](/packages/navigation/side-navigation/docs/navigation-footer).
382
+ */
383
+ children: JSX.Element[] | JSX.Element;
384
+ /**
385
+ * A `testId` prop is provided for specified elements,
386
+ * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
387
+ * serving as a hook for automated tests.
388
+ */
389
+ testId?: string;
390
+ }
391
+
392
+ export declare const SkeletonHeadingItem: (
393
+ props: SkeletonHeadingItemProps,
394
+ ) => JSX.Element | null;
395
+
396
+ export { SkeletonHeadingItemProps };
397
+
398
+ export declare const SkeletonItem: (
399
+ props: SkeletonItemProps,
400
+ ) => JSX.Element | null;
401
+
402
+ export { SkeletonItemProps };
403
+
404
+ /**
405
+ * Used by children of the NestableNavigationContent component to see if they should render or not.
406
+ * If `shouldRender` returns `true` - return your nodes.
407
+ * If it returns `false` - either return `null` or `children` if you have children.
408
+ */
409
+ export declare const useShouldNestedElementRender: () => {
410
+ shouldRender: boolean;
411
+ };
412
+
413
+ export declare const VAR_SCROLL_INDICATOR_COLOR =
414
+ '--ds-menu-scroll-indicator-color';
415
+
416
+ export declare const VAR_SEPARATOR_COLOR = '--ds-menu-seperator-color';
417
+
418
+ export {};
419
+ ```
@@ -1,33 +0,0 @@
1
- import React from 'react';
2
-
3
- import { code, Example, md, Props } from '@atlaskit/docs';
4
-
5
- export default md`
6
- This is the root component you should use every time you want a side navigation experience.
7
- It will take up \`100%\` of its parents height & width -
8
- so make sure you place it into an element that **has its height & width explicitly set**.
9
- Comes with a minimum width of \`240px\`.
10
-
11
- ${code`highlight=1,3,5
12
- import { SideNavigation } from '@atlaskit/side-navigation';
13
-
14
- <SideNavigation label="project">
15
- ...
16
- </SideNavigation>
17
- `}
18
-
19
- ${(
20
- <Example
21
- title=""
22
- Component={require('../examples/side-navigation.tsx').default}
23
- source={require('!!raw-loader!../examples/side-navigation.tsx')}
24
- />
25
- )}
26
-
27
- ${(
28
- <Props
29
- heading="Props"
30
- props={require('!!extract-react-types-loader!../src/components/SideNavigation')}
31
- />
32
- )}
33
- `;
@@ -1,39 +0,0 @@
1
- import React from 'react';
2
-
3
- import { code, Example, md, Props } from '@atlaskit/docs';
4
-
5
- export default md`
6
- Header for the side navigation that is composed of navigation header and header components.
7
- By default it will _not be interactive_ -
8
- however you can pass in your own custom component to make it interactive.
9
-
10
- ${code`
11
- import { NavigationHeader, Header } from '@atlaskit/side-navigation';
12
-
13
- <NavigationHeader>
14
- <Header>My header</Header>
15
- </NavigationHeader>
16
- `}
17
-
18
- ${(
19
- <Example
20
- title=""
21
- Component={require('../examples/navigation-header.tsx').default}
22
- source={require('!!raw-loader!../examples/navigation-header.tsx')}
23
- />
24
- )}
25
-
26
- ${(
27
- <Props
28
- heading="Navigation header props"
29
- props={require('!!extract-react-types-loader!../src/components/NavigationHeader')}
30
- />
31
- )}
32
-
33
- ${(
34
- <Props
35
- heading="Header props"
36
- props={require('!!extract-react-types-loader!../src/components/Header')}
37
- />
38
- )}
39
- `;
@@ -1,40 +0,0 @@
1
- import React from 'react';
2
-
3
- import { code, Example, md, Props } from '@atlaskit/docs';
4
-
5
- export default md`
6
- Used as the container for navigation items.
7
- This is useful for a single level navigation with no need for nested views.
8
- If you have a need for that -
9
- you'll want to check out the [nestable navigation content](/packages/navigation/side-navigation/docs/nestable-navigation-content) component!
10
-
11
- ${code`highlight=1,7,11
12
- import { NavigationContent } from '@atlaskit/side-navigation';
13
-
14
- <NavigationHeader label="project">
15
- <NavigationHeader>
16
- <Header>Money machine</Header>
17
- </NavigationHeader>
18
- <NavigationContent>
19
- <Section>
20
- <ButtonItem>Print money</ButtonItem>
21
- </Section>
22
- </NavigationContent>
23
- </NavigationHeader>
24
- `}
25
-
26
- ${(
27
- <Example
28
- title=""
29
- Component={require('../examples/navigation-content').default}
30
- source={require('!!raw-loader!../examples/navigation-content')}
31
- />
32
- )}
33
-
34
- ${(
35
- <Props
36
- heading="Props"
37
- props={require('!!extract-react-types-loader!../src/components/NavigationContent')}
38
- />
39
- )}
40
- `;
@@ -1,95 +0,0 @@
1
- import React from 'react';
2
-
3
- import { code, Example, md, Props } from '@atlaskit/docs';
4
-
5
- export default md`
6
- Used as the container for navigation items with nested views.
7
- If you have no need for nested views you'll want to check out the [navigation content](/packages/navigation/side-navigation/docs/navigation-content) component instead!
8
-
9
- Nested views are enabled by composing [nesting item](/packages/navigation/side-navigation/docs/nesting-item) components inside this one.
10
-
11
- ${code`highlight=1-4,10-11,15-16
12
- import {
13
- NestableNavigationContent,
14
- NestingItem
15
- } from '@atlaskit/side-navigation';
16
-
17
- <NavigationHeader label="project">
18
- <NavigationHeader>
19
- <Header>Money machine</Header>
20
- </NavigationHeader>
21
- <NestableNavigationContent>
22
- <Section>
23
- <NestingItem title="Print money">
24
- <Section>
25
- <ButtonItem>Money printed</ButtonItem>
26
- </Section>
27
- </NestingItem>
28
- </Section>
29
- </NestableNavigationContent>
30
- </NavigationHeader>
31
- `}
32
-
33
- ${(
34
- <Example
35
- title=""
36
- Component={require('../examples/00-nested-side-navigation').default}
37
- source={require('!!raw-loader!../examples/00-nested-side-navigation')}
38
- />
39
- )}
40
-
41
- ${(
42
- <Props
43
- heading="Props"
44
- props={require('!!extract-react-types-loader!../src/components/NestableNavigationContent')}
45
- />
46
- )}
47
-
48
- ## Custom children
49
-
50
- Sometimes you'll want to use components that aren't supplied by this library,
51
- and that's great!
52
- However you'll need to know that when you do if you don't opt into our "should I render" hook -
53
- your element will be rendered on _every_ nested view,
54
- which may or may not be what you want to happen.
55
-
56
- When writing a leaf node component,
57
- you'll want to conditionally return \`null\`:
58
-
59
- ${code`
60
- import { useShouldNestedElementRender } from '@atlaskit/side-navigation';
61
-
62
- const CustomLeafNode = props => {
63
- const { shouldRender } = useShouldNestedElementRender();
64
- if (!shouldRender) {
65
- return null;
66
- }
67
- return <div>hello world</div>;
68
- );
69
- `}
70
-
71
- When writing a wrapping component,
72
- you'll want to conditionally return \`children\`:
73
-
74
- ${code`
75
- import { useShouldNestedElementRender } from '@atlaskit/side-navigation';
76
-
77
- const CustomWrapper = props => {
78
- const { shouldRender } = useShouldNestedElementRender();
79
- if (!shouldRender) {
80
- return props.children;
81
- }
82
- return <div>{props.children}</div>;
83
- );
84
- `}
85
-
86
- You can see an example of this below.
87
-
88
- ${(
89
- <Example
90
- title=""
91
- Component={require('../examples/custom-nested-children').default}
92
- source={require('!!raw-loader!../examples/custom-nested-children')}
93
- />
94
- )}
95
- `;
@@ -1,38 +0,0 @@
1
- import React from 'react';
2
-
3
- import { code, Example, md, Props } from '@atlaskit/docs';
4
-
5
- export default md`
6
- Footer for the side navigation that is composed of navigation footer and footer components.
7
- Like the header if you pass an interactive element as the custom component to the footer it will appear interactive.
8
-
9
- ${code`
10
- import { NavigationFooter, Footer } from '@atlaskit/side-navigation';
11
-
12
- <NavigationFooter>
13
- <Footer>My footer</Footer>
14
- </NavigationFooter>
15
- `}
16
-
17
- ${(
18
- <Example
19
- title=""
20
- Component={require('../examples/navigation-footer.tsx').default}
21
- source={require('!!raw-loader!../examples/navigation-footer.tsx')}
22
- />
23
- )}
24
-
25
- ${(
26
- <Props
27
- heading="Navigation footer props"
28
- props={require('!!extract-react-types-loader!../src/components/NavigationFooter')}
29
- />
30
- )}
31
-
32
- ${(
33
- <Props
34
- heading="Footer props"
35
- props={require('!!extract-react-types-loader!../src/components/Footer')}
36
- />
37
- )}
38
- `;