@salutejs/plasma-new-hope 0.113.0-canary.1310.10143188146.0 → 0.113.0-canary.1310.10161182267.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Breadcrumbs/utils/index.js +1 -1
- package/cjs/components/Breadcrumbs/utils/index.js.map +1 -1
- package/emotion/cjs/components/Breadcrumbs/Breadcrumbs.template-doc.mdx +96 -0
- package/emotion/cjs/components/Breadcrumbs/utils/index.js +1 -1
- package/emotion/es/components/Breadcrumbs/Breadcrumbs.template-doc.mdx +96 -0
- package/emotion/es/components/Breadcrumbs/utils/index.js +1 -1
- package/es/components/Breadcrumbs/utils/index.js +1 -1
- package/es/components/Breadcrumbs/utils/index.js.map +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/components/Breadcrumbs/Breadcrumbs.template-doc.mdx +96 -0
- package/styled-components/cjs/components/Breadcrumbs/utils/index.js +1 -1
- package/styled-components/es/components/Breadcrumbs/Breadcrumbs.template-doc.mdx +96 -0
- package/styled-components/es/components/Breadcrumbs/utils/index.js +1 -1
@@ -36,7 +36,7 @@ var getRenderItems = function getRenderItems(items, renderSeparator, showItems)
|
|
36
36
|
return /*#__PURE__*/React.createElement(Breadcrumbs_styles.StyledLink, {
|
37
37
|
tabIndex: 0,
|
38
38
|
href: item.href,
|
39
|
-
isHref:
|
39
|
+
isHref: Boolean(item.href)
|
40
40
|
}, item.title);
|
41
41
|
}), renderSeparator, showItems);
|
42
42
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Breadcrumbs/utils/index.tsx"],"sourcesContent":["import React, { ReactNode } from 'react';\n\nimport { BreadcrumbShorter } from '../ui/BreadcrumbShorter/BreadcrumbShorter';\nimport { StyledLink } from '../Breadcrumbs.styles';\nimport { BreadcrumbsItem } from '../Breadcrumbs.types';\n\nexport const shortItems = (items: ReactNode[], renderSeparator: ReactNode, showItems?: number) => {\n if (!showItems || showItems < 2 || items.length <= showItems) {\n return items;\n }\n\n const leftSlice = Math.floor(showItems / 2);\n const rightSlice = items.length - leftSlice - (showItems % 2);\n\n const renderItems: ReactNode[] = items.slice(leftSlice, rightSlice);\n const shorter = <BreadcrumbShorter separator={renderSeparator}>{renderItems}</BreadcrumbShorter>;\n items.splice(leftSlice, rightSlice - leftSlice, shorter);\n return items;\n};\n\nexport const convertIconSize = (size?: 'xs' | 's' | 'm' | 'l') => {\n switch (size) {\n case 's':\n case 'xs':\n return 'xs';\n default:\n return 's';\n }\n};\n\nexport const getRenderItems = (items: BreadcrumbsItem[], renderSeparator: ReactNode, showItems?: number) => {\n return shortItems(\n items.map((item: BreadcrumbsItem) => {\n if ('renderItem' in item) {\n return item.renderItem();\n }\n return (\n <StyledLink tabIndex={0} href={item.href} isHref={
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Breadcrumbs/utils/index.tsx"],"sourcesContent":["import React, { ReactNode } from 'react';\n\nimport { BreadcrumbShorter } from '../ui/BreadcrumbShorter/BreadcrumbShorter';\nimport { StyledLink } from '../Breadcrumbs.styles';\nimport { BreadcrumbsItem } from '../Breadcrumbs.types';\n\nexport const shortItems = (items: ReactNode[], renderSeparator: ReactNode, showItems?: number) => {\n if (!showItems || showItems < 2 || items.length <= showItems) {\n return items;\n }\n\n const leftSlice = Math.floor(showItems / 2);\n const rightSlice = items.length - leftSlice - (showItems % 2);\n\n const renderItems: ReactNode[] = items.slice(leftSlice, rightSlice);\n const shorter = <BreadcrumbShorter separator={renderSeparator}>{renderItems}</BreadcrumbShorter>;\n items.splice(leftSlice, rightSlice - leftSlice, shorter);\n return items;\n};\n\nexport const convertIconSize = (size?: 'xs' | 's' | 'm' | 'l') => {\n switch (size) {\n case 's':\n case 'xs':\n return 'xs';\n default:\n return 's';\n }\n};\n\nexport const getRenderItems = (items: BreadcrumbsItem[], renderSeparator: ReactNode, showItems?: number) => {\n return shortItems(\n items.map((item: BreadcrumbsItem) => {\n if ('renderItem' in item) {\n return item.renderItem();\n }\n return (\n <StyledLink tabIndex={0} href={item.href} isHref={Boolean(item.href)}>\n {item.title}\n </StyledLink>\n );\n }),\n renderSeparator,\n showItems,\n );\n};\n\nexport const addSeparator = (items: ReactNode[], renderSeparator: ReactNode) => {\n return items.flatMap((item, idx) => (idx < items.length - 1 ? [item, renderSeparator] : [item]));\n};\n"],"names":["shortItems","items","renderSeparator","showItems","length","leftSlice","Math","floor","rightSlice","renderItems","slice","shorter","React","createElement","BreadcrumbShorter","separator","splice","convertIconSize","size","getRenderItems","map","item","renderItem","StyledLink","tabIndex","href","isHref","Boolean","title","addSeparator","flatMap","idx"],"mappings":";;;;;;;;AAMO,IAAMA,UAAU,GAAG,SAAbA,UAAUA,CAAIC,KAAkB,EAAEC,eAA0B,EAAEC,SAAkB,EAAK;AAC9F,EAAA,IAAI,CAACA,SAAS,IAAIA,SAAS,GAAG,CAAC,IAAIF,KAAK,CAACG,MAAM,IAAID,SAAS,EAAE;AAC1D,IAAA,OAAOF,KAAK,CAAA;AAChB,GAAA;EAEA,IAAMI,SAAS,GAAGC,IAAI,CAACC,KAAK,CAACJ,SAAS,GAAG,CAAC,CAAC,CAAA;EAC3C,IAAMK,UAAU,GAAGP,KAAK,CAACG,MAAM,GAAGC,SAAS,GAAIF,SAAS,GAAG,CAAE,CAAA;EAE7D,IAAMM,WAAwB,GAAGR,KAAK,CAACS,KAAK,CAACL,SAAS,EAAEG,UAAU,CAAC,CAAA;AACnE,EAAA,IAAMG,OAAO,gBAAGC,KAAA,CAAAC,aAAA,CAACC,mCAAiB,EAAA;AAACC,IAAAA,SAAS,EAAEb,eAAAA;AAAgB,GAAA,EAAEO,WAA+B,CAAC,CAAA;EAChGR,KAAK,CAACe,MAAM,CAACX,SAAS,EAAEG,UAAU,GAAGH,SAAS,EAAEM,OAAO,CAAC,CAAA;AACxD,EAAA,OAAOV,KAAK,CAAA;AAChB,EAAC;IAEYgB,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,IAA6B,EAAK;AAC9D,EAAA,QAAQA,IAAI;AACR,IAAA,KAAK,GA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
+
# Обычное использование
|
12
|
+
|
13
|
+
```tsx live
|
14
|
+
import React from 'react';
|
15
|
+
import { Breadcrumbs } from '@salutejs/plasma-web';
|
16
|
+
|
17
|
+
export function App() {
|
18
|
+
const items = [
|
19
|
+
{ title: 'Home', href: '/' },
|
20
|
+
{ title: 'About as', href: '/' },
|
21
|
+
{ renderItem: () => <span>Custom Item</span> },
|
22
|
+
{ title: 'Contacts' },
|
23
|
+
];
|
24
|
+
|
25
|
+
return (
|
26
|
+
<div>
|
27
|
+
<Breadcrumbs items={items} />
|
28
|
+
</div>
|
29
|
+
);
|
30
|
+
}
|
31
|
+
```
|
32
|
+
# Использование с shorter
|
33
|
+
```tsx live
|
34
|
+
import React from 'react';
|
35
|
+
import { Breadcrumbs } from '@salutejs/plasma-web';
|
36
|
+
|
37
|
+
export function App() {
|
38
|
+
const items = [
|
39
|
+
{ title: 'Home', href: '/' },
|
40
|
+
{ title: 'About as', href: '/' },
|
41
|
+
{ renderItem: () => <span>Custom Item</span> },
|
42
|
+
{ title: 'Contacts' },
|
43
|
+
];
|
44
|
+
|
45
|
+
return (
|
46
|
+
<div style={{"flexDirection": 'column'}}>
|
47
|
+
<div>
|
48
|
+
<Breadcrumbs items={items} showItems={2} />
|
49
|
+
</div>
|
50
|
+
<div>
|
51
|
+
<Breadcrumbs items={items} showItems={3} />
|
52
|
+
</div>
|
53
|
+
</div>
|
54
|
+
);
|
55
|
+
}
|
56
|
+
```
|
57
|
+
|
58
|
+
# Использование с кастомным элементом
|
59
|
+
```tsx live
|
60
|
+
import React from 'react';
|
61
|
+
import { Breadcrumbs, Dropdown } from '@salutejs/plasma-web';
|
62
|
+
|
63
|
+
export function App() {
|
64
|
+
const items = [
|
65
|
+
{ title: 'Home', href: '/' },
|
66
|
+
{ title: 'About as', href: '/' },
|
67
|
+
{
|
68
|
+
renderItem: () => {
|
69
|
+
const itemsDropdown = [
|
70
|
+
{
|
71
|
+
value: 'Custom Item 1',
|
72
|
+
label: 'Custom Item 1',
|
73
|
+
},
|
74
|
+
{
|
75
|
+
value: 'Custom Item 2',
|
76
|
+
label: 'Custom Item 2',
|
77
|
+
},
|
78
|
+
];
|
79
|
+
return (
|
80
|
+
<Dropdown variant="tight" placement="bottom" items={itemsDropdown} trigger="hover">
|
81
|
+
<span>...</span>
|
82
|
+
</Dropdown>
|
83
|
+
);
|
84
|
+
},
|
85
|
+
},
|
86
|
+
{ title: 'Contacts' },
|
87
|
+
];
|
88
|
+
|
89
|
+
|
90
|
+
return (
|
91
|
+
<div style={{height: '200px'}}>
|
92
|
+
<Breadcrumbs items={items} />
|
93
|
+
</div>
|
94
|
+
);
|
95
|
+
}
|
96
|
+
```
|
@@ -38,7 +38,7 @@ var getRenderItems = exports.getRenderItems = function getRenderItems(items, ren
|
|
38
38
|
return /*#__PURE__*/_react["default"].createElement(_Breadcrumbs.StyledLink, {
|
39
39
|
tabIndex: 0,
|
40
40
|
href: item.href,
|
41
|
-
isHref:
|
41
|
+
isHref: Boolean(item.href)
|
42
42
|
}, item.title);
|
43
43
|
}), renderSeparator, showItems);
|
44
44
|
};
|
@@ -0,0 +1,96 @@
|
|
1
|
+
---
|
2
|
+
id: breadcrumbs
|
3
|
+
title: Breadcrumbs
|
4
|
+
---
|
5
|
+
|
6
|
+
import { PropsTable } from '@site/src/components';
|
7
|
+
|
8
|
+
# Breadcrumbs
|
9
|
+
<PropsTable name="Breadcrumbs" />
|
10
|
+
|
11
|
+
# Обычное использование
|
12
|
+
|
13
|
+
```tsx live
|
14
|
+
import React from 'react';
|
15
|
+
import { Breadcrumbs } from '@salutejs/plasma-web';
|
16
|
+
|
17
|
+
export function App() {
|
18
|
+
const items = [
|
19
|
+
{ title: 'Home', href: '/' },
|
20
|
+
{ title: 'About as', href: '/' },
|
21
|
+
{ renderItem: () => <span>Custom Item</span> },
|
22
|
+
{ title: 'Contacts' },
|
23
|
+
];
|
24
|
+
|
25
|
+
return (
|
26
|
+
<div>
|
27
|
+
<Breadcrumbs items={items} />
|
28
|
+
</div>
|
29
|
+
);
|
30
|
+
}
|
31
|
+
```
|
32
|
+
# Использование с shorter
|
33
|
+
```tsx live
|
34
|
+
import React from 'react';
|
35
|
+
import { Breadcrumbs } from '@salutejs/plasma-web';
|
36
|
+
|
37
|
+
export function App() {
|
38
|
+
const items = [
|
39
|
+
{ title: 'Home', href: '/' },
|
40
|
+
{ title: 'About as', href: '/' },
|
41
|
+
{ renderItem: () => <span>Custom Item</span> },
|
42
|
+
{ title: 'Contacts' },
|
43
|
+
];
|
44
|
+
|
45
|
+
return (
|
46
|
+
<div style={{"flexDirection": 'column'}}>
|
47
|
+
<div>
|
48
|
+
<Breadcrumbs items={items} showItems={2} />
|
49
|
+
</div>
|
50
|
+
<div>
|
51
|
+
<Breadcrumbs items={items} showItems={3} />
|
52
|
+
</div>
|
53
|
+
</div>
|
54
|
+
);
|
55
|
+
}
|
56
|
+
```
|
57
|
+
|
58
|
+
# Использование с кастомным элементом
|
59
|
+
```tsx live
|
60
|
+
import React from 'react';
|
61
|
+
import { Breadcrumbs, Dropdown } from '@salutejs/plasma-web';
|
62
|
+
|
63
|
+
export function App() {
|
64
|
+
const items = [
|
65
|
+
{ title: 'Home', href: '/' },
|
66
|
+
{ title: 'About as', href: '/' },
|
67
|
+
{
|
68
|
+
renderItem: () => {
|
69
|
+
const itemsDropdown = [
|
70
|
+
{
|
71
|
+
value: 'Custom Item 1',
|
72
|
+
label: 'Custom Item 1',
|
73
|
+
},
|
74
|
+
{
|
75
|
+
value: 'Custom Item 2',
|
76
|
+
label: 'Custom Item 2',
|
77
|
+
},
|
78
|
+
];
|
79
|
+
return (
|
80
|
+
<Dropdown variant="tight" placement="bottom" items={itemsDropdown} trigger="hover">
|
81
|
+
<span>...</span>
|
82
|
+
</Dropdown>
|
83
|
+
);
|
84
|
+
},
|
85
|
+
},
|
86
|
+
{ title: 'Contacts' },
|
87
|
+
];
|
88
|
+
|
89
|
+
|
90
|
+
return (
|
91
|
+
<div style={{height: '200px'}}>
|
92
|
+
<Breadcrumbs items={items} />
|
93
|
+
</div>
|
94
|
+
);
|
95
|
+
}
|
96
|
+
```
|
@@ -31,7 +31,7 @@ export var getRenderItems = function getRenderItems(items, renderSeparator, show
|
|
31
31
|
return /*#__PURE__*/React.createElement(StyledLink, {
|
32
32
|
tabIndex: 0,
|
33
33
|
href: item.href,
|
34
|
-
isHref:
|
34
|
+
isHref: Boolean(item.href)
|
35
35
|
}, item.title);
|
36
36
|
}), renderSeparator, showItems);
|
37
37
|
};
|
@@ -32,7 +32,7 @@ var getRenderItems = function getRenderItems(items, renderSeparator, showItems)
|
|
32
32
|
return /*#__PURE__*/React.createElement(StyledLink, {
|
33
33
|
tabIndex: 0,
|
34
34
|
href: item.href,
|
35
|
-
isHref:
|
35
|
+
isHref: Boolean(item.href)
|
36
36
|
}, item.title);
|
37
37
|
}), renderSeparator, showItems);
|
38
38
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Breadcrumbs/utils/index.tsx"],"sourcesContent":["import React, { ReactNode } from 'react';\n\nimport { BreadcrumbShorter } from '../ui/BreadcrumbShorter/BreadcrumbShorter';\nimport { StyledLink } from '../Breadcrumbs.styles';\nimport { BreadcrumbsItem } from '../Breadcrumbs.types';\n\nexport const shortItems = (items: ReactNode[], renderSeparator: ReactNode, showItems?: number) => {\n if (!showItems || showItems < 2 || items.length <= showItems) {\n return items;\n }\n\n const leftSlice = Math.floor(showItems / 2);\n const rightSlice = items.length - leftSlice - (showItems % 2);\n\n const renderItems: ReactNode[] = items.slice(leftSlice, rightSlice);\n const shorter = <BreadcrumbShorter separator={renderSeparator}>{renderItems}</BreadcrumbShorter>;\n items.splice(leftSlice, rightSlice - leftSlice, shorter);\n return items;\n};\n\nexport const convertIconSize = (size?: 'xs' | 's' | 'm' | 'l') => {\n switch (size) {\n case 's':\n case 'xs':\n return 'xs';\n default:\n return 's';\n }\n};\n\nexport const getRenderItems = (items: BreadcrumbsItem[], renderSeparator: ReactNode, showItems?: number) => {\n return shortItems(\n items.map((item: BreadcrumbsItem) => {\n if ('renderItem' in item) {\n return item.renderItem();\n }\n return (\n <StyledLink tabIndex={0} href={item.href} isHref={
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Breadcrumbs/utils/index.tsx"],"sourcesContent":["import React, { ReactNode } from 'react';\n\nimport { BreadcrumbShorter } from '../ui/BreadcrumbShorter/BreadcrumbShorter';\nimport { StyledLink } from '../Breadcrumbs.styles';\nimport { BreadcrumbsItem } from '../Breadcrumbs.types';\n\nexport const shortItems = (items: ReactNode[], renderSeparator: ReactNode, showItems?: number) => {\n if (!showItems || showItems < 2 || items.length <= showItems) {\n return items;\n }\n\n const leftSlice = Math.floor(showItems / 2);\n const rightSlice = items.length - leftSlice - (showItems % 2);\n\n const renderItems: ReactNode[] = items.slice(leftSlice, rightSlice);\n const shorter = <BreadcrumbShorter separator={renderSeparator}>{renderItems}</BreadcrumbShorter>;\n items.splice(leftSlice, rightSlice - leftSlice, shorter);\n return items;\n};\n\nexport const convertIconSize = (size?: 'xs' | 's' | 'm' | 'l') => {\n switch (size) {\n case 's':\n case 'xs':\n return 'xs';\n default:\n return 's';\n }\n};\n\nexport const getRenderItems = (items: BreadcrumbsItem[], renderSeparator: ReactNode, showItems?: number) => {\n return shortItems(\n items.map((item: BreadcrumbsItem) => {\n if ('renderItem' in item) {\n return item.renderItem();\n }\n return (\n <StyledLink tabIndex={0} href={item.href} isHref={Boolean(item.href)}>\n {item.title}\n </StyledLink>\n );\n }),\n renderSeparator,\n showItems,\n );\n};\n\nexport const addSeparator = (items: ReactNode[], renderSeparator: ReactNode) => {\n return items.flatMap((item, idx) => (idx < items.length - 1 ? [item, renderSeparator] : [item]));\n};\n"],"names":["shortItems","items","renderSeparator","showItems","length","leftSlice","Math","floor","rightSlice","renderItems","slice","shorter","React","createElement","BreadcrumbShorter","separator","splice","convertIconSize","size","getRenderItems","map","item","renderItem","StyledLink","tabIndex","href","isHref","Boolean","title","addSeparator","flat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,IAAI,CAACC,UAAU,EAAE,CAAA;AAC5B,KAAA;AACA,IAAA,oBACIV,KAAA,CAAAC,aAAA,CAACU,UAAU,EAAA;AAACC,MAAAA,QAAQ,EAAE,CAAE;MAACC,IAAI,EAAEJ,IAAI,CAACI,IAAK;AAACC,MAAAA,MAAM,EAAEC,OAAO,CAACN,IAAI,CAACI,IAAI,CAAA;KAC9DJ,EAAAA,IAAI,CAACO,KACE,CAAC,CAAA;AAErB,GAAC,CAAC,EACF1B,eAAe,EACfC,SACJ,CAAC,CAAA;AACL,EAAC;AAEM,IAAM0B,YAAY,GAAG,SAAfA,YAAYA,CAAI5B,KAAkB,EAAEC,eAA0B,EAAK;AAC5E,EAAA,OAAOD,KAAK,CAAC6B,OAAO,CAAC,UAACT,IAAI,EAAEU,GAAG,EAAA;AAAA,IAAA,OAAMA,GAAG,GAAG9B,KAAK,CAACG,MAAM,GAAG,CAAC,GAAG,CAACiB,IAAI,EAAEnB,eAAe,CAAC,GAAG,CAACmB,IAAI,CAAC,CAAA;AAAA,GAAC,CAAC,CAAA;AACpG;;;;"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@salutejs/plasma-new-hope",
|
3
|
-
"version": "0.113.0-canary.1310.
|
3
|
+
"version": "0.113.0-canary.1310.10161182267.0",
|
4
4
|
"description": "Salute Design System blueprint",
|
5
5
|
"main": "cjs/index.js",
|
6
6
|
"module": "es/index.js",
|
@@ -118,5 +118,5 @@
|
|
118
118
|
"react-popper": "2.3.0",
|
119
119
|
"storeon": "3.1.5"
|
120
120
|
},
|
121
|
-
"gitHead": "
|
121
|
+
"gitHead": "f07cdc112345590a64f380ce9d514678e2107871"
|
122
122
|
}
|
@@ -0,0 +1,96 @@
|
|
1
|
+
---
|
2
|
+
id: breadcrumbs
|
3
|
+
title: Breadcrumbs
|
4
|
+
---
|
5
|
+
|
6
|
+
import { PropsTable } from '@site/src/components';
|
7
|
+
|
8
|
+
# Breadcrumbs
|
9
|
+
<PropsTable name="Breadcrumbs" />
|
10
|
+
|
11
|
+
# Обычное использование
|
12
|
+
|
13
|
+
```tsx live
|
14
|
+
import React from 'react';
|
15
|
+
import { Breadcrumbs } from '@salutejs/plasma-web';
|
16
|
+
|
17
|
+
export function App() {
|
18
|
+
const items = [
|
19
|
+
{ title: 'Home', href: '/' },
|
20
|
+
{ title: 'About as', href: '/' },
|
21
|
+
{ renderItem: () => <span>Custom Item</span> },
|
22
|
+
{ title: 'Contacts' },
|
23
|
+
];
|
24
|
+
|
25
|
+
return (
|
26
|
+
<div>
|
27
|
+
<Breadcrumbs items={items} />
|
28
|
+
</div>
|
29
|
+
);
|
30
|
+
}
|
31
|
+
```
|
32
|
+
# Использование с shorter
|
33
|
+
```tsx live
|
34
|
+
import React from 'react';
|
35
|
+
import { Breadcrumbs } from '@salutejs/plasma-web';
|
36
|
+
|
37
|
+
export function App() {
|
38
|
+
const items = [
|
39
|
+
{ title: 'Home', href: '/' },
|
40
|
+
{ title: 'About as', href: '/' },
|
41
|
+
{ renderItem: () => <span>Custom Item</span> },
|
42
|
+
{ title: 'Contacts' },
|
43
|
+
];
|
44
|
+
|
45
|
+
return (
|
46
|
+
<div style={{"flexDirection": 'column'}}>
|
47
|
+
<div>
|
48
|
+
<Breadcrumbs items={items} showItems={2} />
|
49
|
+
</div>
|
50
|
+
<div>
|
51
|
+
<Breadcrumbs items={items} showItems={3} />
|
52
|
+
</div>
|
53
|
+
</div>
|
54
|
+
);
|
55
|
+
}
|
56
|
+
```
|
57
|
+
|
58
|
+
# Использование с кастомным элементом
|
59
|
+
```tsx live
|
60
|
+
import React from 'react';
|
61
|
+
import { Breadcrumbs, Dropdown } from '@salutejs/plasma-web';
|
62
|
+
|
63
|
+
export function App() {
|
64
|
+
const items = [
|
65
|
+
{ title: 'Home', href: '/' },
|
66
|
+
{ title: 'About as', href: '/' },
|
67
|
+
{
|
68
|
+
renderItem: () => {
|
69
|
+
const itemsDropdown = [
|
70
|
+
{
|
71
|
+
value: 'Custom Item 1',
|
72
|
+
label: 'Custom Item 1',
|
73
|
+
},
|
74
|
+
{
|
75
|
+
value: 'Custom Item 2',
|
76
|
+
label: 'Custom Item 2',
|
77
|
+
},
|
78
|
+
];
|
79
|
+
return (
|
80
|
+
<Dropdown variant="tight" placement="bottom" items={itemsDropdown} trigger="hover">
|
81
|
+
<span>...</span>
|
82
|
+
</Dropdown>
|
83
|
+
);
|
84
|
+
},
|
85
|
+
},
|
86
|
+
{ title: 'Contacts' },
|
87
|
+
];
|
88
|
+
|
89
|
+
|
90
|
+
return (
|
91
|
+
<div style={{height: '200px'}}>
|
92
|
+
<Breadcrumbs items={items} />
|
93
|
+
</div>
|
94
|
+
);
|
95
|
+
}
|
96
|
+
```
|
@@ -38,7 +38,7 @@ var getRenderItems = exports.getRenderItems = function getRenderItems(items, ren
|
|
38
38
|
return /*#__PURE__*/_react["default"].createElement(_Breadcrumbs.StyledLink, {
|
39
39
|
tabIndex: 0,
|
40
40
|
href: item.href,
|
41
|
-
isHref:
|
41
|
+
isHref: Boolean(item.href)
|
42
42
|
}, item.title);
|
43
43
|
}), renderSeparator, showItems);
|
44
44
|
};
|
@@ -0,0 +1,96 @@
|
|
1
|
+
---
|
2
|
+
id: breadcrumbs
|
3
|
+
title: Breadcrumbs
|
4
|
+
---
|
5
|
+
|
6
|
+
import { PropsTable } from '@site/src/components';
|
7
|
+
|
8
|
+
# Breadcrumbs
|
9
|
+
<PropsTable name="Breadcrumbs" />
|
10
|
+
|
11
|
+
# Обычное использование
|
12
|
+
|
13
|
+
```tsx live
|
14
|
+
import React from 'react';
|
15
|
+
import { Breadcrumbs } from '@salutejs/plasma-web';
|
16
|
+
|
17
|
+
export function App() {
|
18
|
+
const items = [
|
19
|
+
{ title: 'Home', href: '/' },
|
20
|
+
{ title: 'About as', href: '/' },
|
21
|
+
{ renderItem: () => <span>Custom Item</span> },
|
22
|
+
{ title: 'Contacts' },
|
23
|
+
];
|
24
|
+
|
25
|
+
return (
|
26
|
+
<div>
|
27
|
+
<Breadcrumbs items={items} />
|
28
|
+
</div>
|
29
|
+
);
|
30
|
+
}
|
31
|
+
```
|
32
|
+
# Использование с shorter
|
33
|
+
```tsx live
|
34
|
+
import React from 'react';
|
35
|
+
import { Breadcrumbs } from '@salutejs/plasma-web';
|
36
|
+
|
37
|
+
export function App() {
|
38
|
+
const items = [
|
39
|
+
{ title: 'Home', href: '/' },
|
40
|
+
{ title: 'About as', href: '/' },
|
41
|
+
{ renderItem: () => <span>Custom Item</span> },
|
42
|
+
{ title: 'Contacts' },
|
43
|
+
];
|
44
|
+
|
45
|
+
return (
|
46
|
+
<div style={{"flexDirection": 'column'}}>
|
47
|
+
<div>
|
48
|
+
<Breadcrumbs items={items} showItems={2} />
|
49
|
+
</div>
|
50
|
+
<div>
|
51
|
+
<Breadcrumbs items={items} showItems={3} />
|
52
|
+
</div>
|
53
|
+
</div>
|
54
|
+
);
|
55
|
+
}
|
56
|
+
```
|
57
|
+
|
58
|
+
# Использование с кастомным элементом
|
59
|
+
```tsx live
|
60
|
+
import React from 'react';
|
61
|
+
import { Breadcrumbs, Dropdown } from '@salutejs/plasma-web';
|
62
|
+
|
63
|
+
export function App() {
|
64
|
+
const items = [
|
65
|
+
{ title: 'Home', href: '/' },
|
66
|
+
{ title: 'About as', href: '/' },
|
67
|
+
{
|
68
|
+
renderItem: () => {
|
69
|
+
const itemsDropdown = [
|
70
|
+
{
|
71
|
+
value: 'Custom Item 1',
|
72
|
+
label: 'Custom Item 1',
|
73
|
+
},
|
74
|
+
{
|
75
|
+
value: 'Custom Item 2',
|
76
|
+
label: 'Custom Item 2',
|
77
|
+
},
|
78
|
+
];
|
79
|
+
return (
|
80
|
+
<Dropdown variant="tight" placement="bottom" items={itemsDropdown} trigger="hover">
|
81
|
+
<span>...</span>
|
82
|
+
</Dropdown>
|
83
|
+
);
|
84
|
+
},
|
85
|
+
},
|
86
|
+
{ title: 'Contacts' },
|
87
|
+
];
|
88
|
+
|
89
|
+
|
90
|
+
return (
|
91
|
+
<div style={{height: '200px'}}>
|
92
|
+
<Breadcrumbs items={items} />
|
93
|
+
</div>
|
94
|
+
);
|
95
|
+
}
|
96
|
+
```
|
@@ -31,7 +31,7 @@ export var getRenderItems = function getRenderItems(items, renderSeparator, show
|
|
31
31
|
return /*#__PURE__*/React.createElement(StyledLink, {
|
32
32
|
tabIndex: 0,
|
33
33
|
href: item.href,
|
34
|
-
isHref:
|
34
|
+
isHref: Boolean(item.href)
|
35
35
|
}, item.title);
|
36
36
|
}), renderSeparator, showItems);
|
37
37
|
};
|