@zendeskgarden/react-breadcrumbs 9.0.0-next.2 → 9.0.0-next.20
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/dist/esm/elements/Breadcrumb.js +40 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/chevron-right-stroke.svg.js +25 -0
- package/dist/esm/styled/StyledBreadcrumb.js +22 -0
- package/dist/esm/styled/StyledBreadcrumbItem.js +47 -0
- package/dist/esm/styled/StyledCenteredBreadcrumbItem.js +21 -0
- package/dist/esm/styled/StyledChevronIcon.js +34 -0
- package/dist/index.cjs.js +35 -23
- package/dist/typings/styled/StyledBreadcrumbItem.d.ts +3 -2
- package/dist/typings/styled/StyledChevronIcon.d.ts +3 -4
- package/package.json +9 -9
- package/dist/index.esm.js +0 -123
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import React__default, { forwardRef, Children, cloneElement } from 'react';
|
|
8
|
+
import { useBreadcrumb } from '@zendeskgarden/container-breadcrumb';
|
|
9
|
+
import { useText } from '@zendeskgarden/react-theming';
|
|
10
|
+
import { StyledBreadcrumb } from '../styled/StyledBreadcrumb.js';
|
|
11
|
+
import { StyledChevronIcon } from '../styled/StyledChevronIcon.js';
|
|
12
|
+
import { StyledBreadcrumbItem } from '../styled/StyledBreadcrumbItem.js';
|
|
13
|
+
import { StyledCenteredBreadcrumbItem } from '../styled/StyledCenteredBreadcrumbItem.js';
|
|
14
|
+
|
|
15
|
+
const Breadcrumb = forwardRef((props, ref) => {
|
|
16
|
+
const {
|
|
17
|
+
getContainerProps,
|
|
18
|
+
getCurrentPageProps
|
|
19
|
+
} = useBreadcrumb();
|
|
20
|
+
const totalChildren = Children.count(props.children);
|
|
21
|
+
const mappedChildren = Children.map(props.children, (child, index) => {
|
|
22
|
+
const isLastItem = index === totalChildren - 1;
|
|
23
|
+
if (isLastItem) {
|
|
24
|
+
return React__default.createElement(StyledBreadcrumbItem, {
|
|
25
|
+
$isCurrent: true
|
|
26
|
+
}, cloneElement(child, getCurrentPageProps()));
|
|
27
|
+
}
|
|
28
|
+
return React__default.createElement(React__default.Fragment, null, React__default.createElement(StyledBreadcrumbItem, null, child), React__default.createElement(StyledCenteredBreadcrumbItem, null, React__default.createElement(StyledChevronIcon, null)));
|
|
29
|
+
});
|
|
30
|
+
const ariaLabel = useText(Breadcrumb, props, 'aria-label', 'Breadcrumbs');
|
|
31
|
+
return React__default.createElement("nav", getContainerProps({
|
|
32
|
+
...props,
|
|
33
|
+
ref,
|
|
34
|
+
role: null,
|
|
35
|
+
'aria-label': ariaLabel
|
|
36
|
+
}), React__default.createElement(StyledBreadcrumb, null, mappedChildren));
|
|
37
|
+
});
|
|
38
|
+
Breadcrumb.displayName = 'Breadcrumb';
|
|
39
|
+
|
|
40
|
+
export { Breadcrumb };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
|
|
9
|
+
var _path;
|
|
10
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
11
|
+
var SvgChevronRightStroke = function SvgChevronRightStroke(props) {
|
|
12
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
13
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
14
|
+
width: 12,
|
|
15
|
+
height: 12,
|
|
16
|
+
focusable: "false",
|
|
17
|
+
viewBox: "0 0 12 12",
|
|
18
|
+
"aria-hidden": "true"
|
|
19
|
+
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
20
|
+
fill: "currentColor",
|
|
21
|
+
d: "M3.646 10.354a.5.5 0 01-.057-.638l.057-.07L7.293 6 3.646 2.354a.5.5 0 01-.057-.638l.057-.07a.5.5 0 01.638-.057l.07.057 4 4a.5.5 0 01.057.638l-.057.07-4 4a.5.5 0 01-.708 0z"
|
|
22
|
+
})));
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { SvgChevronRightStroke as default };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const COMPONENT_ID = 'breadcrumbs.list';
|
|
11
|
+
const StyledBreadcrumb = styled.ol.attrs({
|
|
12
|
+
'data-garden-id': COMPONENT_ID,
|
|
13
|
+
'data-garden-version': '9.0.0-next.20'
|
|
14
|
+
}).withConfig({
|
|
15
|
+
displayName: "StyledBreadcrumb",
|
|
16
|
+
componentId: "sc-11jrinn-0"
|
|
17
|
+
})(["display:flex;margin:0;padding:0;list-style:none;font-size:", ";direction:", ";", ";"], props => props.theme.fontSizes.md, props => props.theme.rtl && 'rtl', props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
18
|
+
StyledBreadcrumb.defaultProps = {
|
|
19
|
+
theme: DEFAULT_THEME
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { StyledBreadcrumb };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getLineHeight, getColor } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const COMPONENT_ID = 'breadcrumbs.item';
|
|
11
|
+
const sizeStyles = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
theme
|
|
14
|
+
} = _ref;
|
|
15
|
+
return css(["line-height:", ";white-space:nowrap;& > :link,& > :visited{white-space:inherit;}"], getLineHeight(theme.space.base * 5, theme.fontSizes.md));
|
|
16
|
+
};
|
|
17
|
+
const colorStyles = _ref2 => {
|
|
18
|
+
let {
|
|
19
|
+
$isCurrent,
|
|
20
|
+
theme
|
|
21
|
+
} = _ref2;
|
|
22
|
+
return css(["color:", ";", ""], $isCurrent ? getColor({
|
|
23
|
+
variable: 'foreground.subtle',
|
|
24
|
+
theme
|
|
25
|
+
}) : 'inherit', $isCurrent && `
|
|
26
|
+
& > :link,
|
|
27
|
+
& > :visited,
|
|
28
|
+
& > :link:hover,
|
|
29
|
+
& > :visited:hover,
|
|
30
|
+
& > :link:focus,
|
|
31
|
+
& > :visited:focus {
|
|
32
|
+
color: inherit; /* [1] */
|
|
33
|
+
}
|
|
34
|
+
`);
|
|
35
|
+
};
|
|
36
|
+
const StyledBreadcrumbItem = styled.li.attrs({
|
|
37
|
+
'data-garden-id': COMPONENT_ID,
|
|
38
|
+
'data-garden-version': '9.0.0-next.20'
|
|
39
|
+
}).withConfig({
|
|
40
|
+
displayName: "StyledBreadcrumbItem",
|
|
41
|
+
componentId: "sc-r0suq7-0"
|
|
42
|
+
})(["font-size:inherit;", " ", ";", ";"], sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
43
|
+
StyledBreadcrumbItem.defaultProps = {
|
|
44
|
+
theme: DEFAULT_THEME
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export { StyledBreadcrumbItem };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import { DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { StyledBreadcrumbItem } from './StyledBreadcrumbItem.js';
|
|
10
|
+
|
|
11
|
+
const StyledCenteredBreadcrumbItem = styled(StyledBreadcrumbItem).attrs({
|
|
12
|
+
'aria-hidden': true
|
|
13
|
+
}).withConfig({
|
|
14
|
+
displayName: "StyledCenteredBreadcrumbItem",
|
|
15
|
+
componentId: "sc-1ces9y2-0"
|
|
16
|
+
})(["display:flex;align-items:center;"]);
|
|
17
|
+
StyledCenteredBreadcrumbItem.defaultProps = {
|
|
18
|
+
theme: DEFAULT_THEME
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { StyledCenteredBreadcrumbItem };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import React__default from 'react';
|
|
8
|
+
import styled from 'styled-components';
|
|
9
|
+
import { em } from 'polished';
|
|
10
|
+
import { getColor, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
11
|
+
import SvgChevronRightStroke from '../node_modules/@zendeskgarden/svg-icons/src/12/chevron-right-stroke.svg.js';
|
|
12
|
+
|
|
13
|
+
const StyledChevronIcon = styled(_ref => {
|
|
14
|
+
let {
|
|
15
|
+
children,
|
|
16
|
+
theme,
|
|
17
|
+
...props
|
|
18
|
+
} = _ref;
|
|
19
|
+
return React__default.createElement(SvgChevronRightStroke, props);
|
|
20
|
+
}).attrs({
|
|
21
|
+
role: 'presentation',
|
|
22
|
+
'aria-hidden': 'true'
|
|
23
|
+
}).withConfig({
|
|
24
|
+
displayName: "StyledChevronIcon",
|
|
25
|
+
componentId: "sc-9r9qrm-0"
|
|
26
|
+
})(["transform:", ";margin:0 ", ";color:", ";"], p => p.theme.rtl && `rotate(180deg);`, p => em(p.theme.space.base, p.theme.fontSizes.md), p => getColor({
|
|
27
|
+
variable: 'foreground.subtle',
|
|
28
|
+
theme: p.theme
|
|
29
|
+
}));
|
|
30
|
+
StyledChevronIcon.defaultProps = {
|
|
31
|
+
theme: DEFAULT_THEME
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export { StyledChevronIcon };
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
8
7
|
'use strict';
|
|
9
8
|
|
|
10
9
|
var React = require('react');
|
|
@@ -39,7 +38,7 @@ var styled__default = /*#__PURE__*/_interopDefault(styled);
|
|
|
39
38
|
const COMPONENT_ID$1 = 'breadcrumbs.list';
|
|
40
39
|
const StyledBreadcrumb = styled__default.default.ol.attrs({
|
|
41
40
|
'data-garden-id': COMPONENT_ID$1,
|
|
42
|
-
'data-garden-version': '9.0.0-next.
|
|
41
|
+
'data-garden-version': '9.0.0-next.20'
|
|
43
42
|
}).withConfig({
|
|
44
43
|
displayName: "StyledBreadcrumb",
|
|
45
44
|
componentId: "sc-11jrinn-0"
|
|
@@ -49,7 +48,7 @@ StyledBreadcrumb.defaultProps = {
|
|
|
49
48
|
};
|
|
50
49
|
|
|
51
50
|
var _path;
|
|
52
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
51
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
53
52
|
var SvgChevronRightStroke = function SvgChevronRightStroke(props) {
|
|
54
53
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
55
54
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -64,47 +63,60 @@ var SvgChevronRightStroke = function SvgChevronRightStroke(props) {
|
|
|
64
63
|
})));
|
|
65
64
|
};
|
|
66
65
|
|
|
67
|
-
const
|
|
68
|
-
|
|
66
|
+
const StyledChevronIcon = styled__default.default(_ref => {
|
|
67
|
+
let {
|
|
68
|
+
children,
|
|
69
69
|
theme,
|
|
70
|
-
...
|
|
71
|
-
} =
|
|
72
|
-
return React__namespace.default.createElement(SvgChevronRightStroke,
|
|
73
|
-
}
|
|
74
|
-
const StyledChevronIcon = styled__default.default(ValidChevronIcon).attrs({
|
|
70
|
+
...props
|
|
71
|
+
} = _ref;
|
|
72
|
+
return React__namespace.default.createElement(SvgChevronRightStroke, props);
|
|
73
|
+
}).attrs({
|
|
75
74
|
role: 'presentation',
|
|
76
75
|
'aria-hidden': 'true'
|
|
77
76
|
}).withConfig({
|
|
78
77
|
displayName: "StyledChevronIcon",
|
|
79
78
|
componentId: "sc-9r9qrm-0"
|
|
80
|
-
})(["transform:", ";margin:0 ", ";color:", ";"],
|
|
79
|
+
})(["transform:", ";margin:0 ", ";color:", ";"], p => p.theme.rtl && `rotate(180deg);`, p => polished.em(p.theme.space.base, p.theme.fontSizes.md), p => reactTheming.getColor({
|
|
80
|
+
variable: 'foreground.subtle',
|
|
81
|
+
theme: p.theme
|
|
82
|
+
}));
|
|
81
83
|
StyledChevronIcon.defaultProps = {
|
|
82
84
|
theme: reactTheming.DEFAULT_THEME
|
|
83
85
|
};
|
|
84
86
|
|
|
85
87
|
const COMPONENT_ID = 'breadcrumbs.item';
|
|
86
|
-
const
|
|
88
|
+
const sizeStyles = _ref => {
|
|
87
89
|
let {
|
|
88
|
-
|
|
90
|
+
theme
|
|
89
91
|
} = _ref;
|
|
90
|
-
return styled.css(["
|
|
92
|
+
return styled.css(["line-height:", ";white-space:nowrap;& > :link,& > :visited{white-space:inherit;}"], reactTheming.getLineHeight(theme.space.base * 5, theme.fontSizes.md));
|
|
93
|
+
};
|
|
94
|
+
const colorStyles = _ref2 => {
|
|
95
|
+
let {
|
|
96
|
+
$isCurrent,
|
|
97
|
+
theme
|
|
98
|
+
} = _ref2;
|
|
99
|
+
return styled.css(["color:", ";", ""], $isCurrent ? reactTheming.getColor({
|
|
100
|
+
variable: 'foreground.subtle',
|
|
101
|
+
theme
|
|
102
|
+
}) : 'inherit', $isCurrent && `
|
|
91
103
|
& > :link,
|
|
92
104
|
& > :visited,
|
|
93
105
|
& > :link:hover,
|
|
94
106
|
& > :visited:hover,
|
|
95
107
|
& > :link:focus,
|
|
96
108
|
& > :visited:focus {
|
|
97
|
-
color: inherit;
|
|
109
|
+
color: inherit; /* [1] */
|
|
98
110
|
}
|
|
99
111
|
`);
|
|
100
112
|
};
|
|
101
113
|
const StyledBreadcrumbItem = styled__default.default.li.attrs({
|
|
102
114
|
'data-garden-id': COMPONENT_ID,
|
|
103
|
-
'data-garden-version': '9.0.0-next.
|
|
115
|
+
'data-garden-version': '9.0.0-next.20'
|
|
104
116
|
}).withConfig({
|
|
105
117
|
displayName: "StyledBreadcrumbItem",
|
|
106
118
|
componentId: "sc-r0suq7-0"
|
|
107
|
-
})(["
|
|
119
|
+
})(["font-size:inherit;", " ", ";", ";"], sizeStyles, colorStyles, props => reactTheming.retrieveComponentStyles(COMPONENT_ID, props));
|
|
108
120
|
StyledBreadcrumbItem.defaultProps = {
|
|
109
121
|
theme: reactTheming.DEFAULT_THEME
|
|
110
122
|
};
|
|
@@ -129,7 +141,7 @@ const Breadcrumb = React.forwardRef((props, ref) => {
|
|
|
129
141
|
const isLastItem = index === totalChildren - 1;
|
|
130
142
|
if (isLastItem) {
|
|
131
143
|
return React__namespace.default.createElement(StyledBreadcrumbItem, {
|
|
132
|
-
isCurrent: true
|
|
144
|
+
$isCurrent: true
|
|
133
145
|
}, React.cloneElement(child, getCurrentPageProps()));
|
|
134
146
|
}
|
|
135
147
|
return React__namespace.default.createElement(React__namespace.default.Fragment, null, React__namespace.default.createElement(StyledBreadcrumbItem, null, child), React__namespace.default.createElement(StyledCenteredBreadcrumbItem, null, React__namespace.default.createElement(StyledChevronIcon, null)));
|
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
|
+
import { DefaultTheme } from 'styled-components';
|
|
7
8
|
export interface IStyledBreadcrumbItemProps {
|
|
8
|
-
isCurrent?: boolean;
|
|
9
|
+
$isCurrent?: boolean;
|
|
9
10
|
}
|
|
10
|
-
export declare const StyledBreadcrumbItem: import("styled-components").StyledComponent<"li",
|
|
11
|
+
export declare const StyledBreadcrumbItem: import("styled-components").StyledComponent<"li", DefaultTheme, {
|
|
11
12
|
'data-garden-id': string;
|
|
12
13
|
'data-garden-version': string;
|
|
13
14
|
} & IStyledBreadcrumbItemProps, "data-garden-id" | "data-garden-version">;
|
|
@@ -5,11 +5,10 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import { ThemeProps, DefaultTheme } from 'styled-components';
|
|
9
8
|
/**
|
|
10
9
|
* Accepts all `<svg>` props
|
|
11
10
|
*/
|
|
12
|
-
export declare const StyledChevronIcon: import("styled-components").StyledComponent<React.
|
|
13
|
-
role:
|
|
14
|
-
'aria-hidden':
|
|
11
|
+
export declare const StyledChevronIcon: import("styled-components").StyledComponent<({ children, theme, ...props }: any) => React.JSX.Element, import("styled-components").DefaultTheme, {
|
|
12
|
+
role: string;
|
|
13
|
+
'aria-hidden': string;
|
|
15
14
|
}, "role" | "aria-hidden">;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zendeskgarden/react-breadcrumbs",
|
|
3
|
-
"version": "9.0.0-next.
|
|
3
|
+
"version": "9.0.0-next.20",
|
|
4
4
|
"description": "Components relating to breadcrumbs in the Garden Design System",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Zendesk Garden <garden@zendesk.com>",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"url": "https://github.com/zendeskgarden/react-components/issues"
|
|
11
11
|
},
|
|
12
12
|
"main": "dist/index.cjs.js",
|
|
13
|
-
"module": "dist/index.
|
|
13
|
+
"module": "dist/esm/index.js",
|
|
14
14
|
"files": [
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
@@ -21,19 +21,19 @@
|
|
|
21
21
|
"sideEffects": false,
|
|
22
22
|
"types": "dist/typings/index.d.ts",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@zendeskgarden/container-breadcrumb": "^1.0.
|
|
25
|
-
"polished": "^4.
|
|
24
|
+
"@zendeskgarden/container-breadcrumb": "^1.0.8",
|
|
25
|
+
"polished": "^4.3.1",
|
|
26
26
|
"prop-types": "^15.5.7"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@zendeskgarden/react-theming": "
|
|
29
|
+
"@zendeskgarden/react-theming": ">=9.0.0-next",
|
|
30
30
|
"react": ">=16.8.0",
|
|
31
31
|
"react-dom": ">=16.8.0",
|
|
32
|
-
"styled-components": "^5.1
|
|
32
|
+
"styled-components": "^5.3.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@zendeskgarden/react-theming": "^9.0.0-next.
|
|
36
|
-
"@zendeskgarden/svg-icons": "7.
|
|
35
|
+
"@zendeskgarden/react-theming": "^9.0.0-next.20",
|
|
36
|
+
"@zendeskgarden/svg-icons": "7.1.1"
|
|
37
37
|
},
|
|
38
38
|
"keywords": [
|
|
39
39
|
"components",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"access": "public"
|
|
46
46
|
},
|
|
47
47
|
"zendeskgarden:src": "src/index.ts",
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "eab087ac0d6e74b3a4489d37d067baf7a225e7a8"
|
|
49
49
|
}
|
package/dist/index.esm.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright Zendesk, Inc.
|
|
3
|
-
*
|
|
4
|
-
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
-
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import * as React from 'react';
|
|
9
|
-
import React__default, { forwardRef, Children, cloneElement } from 'react';
|
|
10
|
-
import { useBreadcrumb } from '@zendeskgarden/container-breadcrumb';
|
|
11
|
-
import { retrieveComponentStyles, DEFAULT_THEME, getColor, getLineHeight, useText } from '@zendeskgarden/react-theming';
|
|
12
|
-
import styled, { css } from 'styled-components';
|
|
13
|
-
import { em } from 'polished';
|
|
14
|
-
|
|
15
|
-
const COMPONENT_ID$1 = 'breadcrumbs.list';
|
|
16
|
-
const StyledBreadcrumb = styled.ol.attrs({
|
|
17
|
-
'data-garden-id': COMPONENT_ID$1,
|
|
18
|
-
'data-garden-version': '9.0.0-next.2'
|
|
19
|
-
}).withConfig({
|
|
20
|
-
displayName: "StyledBreadcrumb",
|
|
21
|
-
componentId: "sc-11jrinn-0"
|
|
22
|
-
})(["display:flex;margin:0;padding:0;list-style:none;font-size:", ";direction:", ";", ";"], props => props.theme.fontSizes.md, props => props.theme.rtl && 'rtl', props => retrieveComponentStyles(COMPONENT_ID$1, props));
|
|
23
|
-
StyledBreadcrumb.defaultProps = {
|
|
24
|
-
theme: DEFAULT_THEME
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
var _path;
|
|
28
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
29
|
-
var SvgChevronRightStroke = function SvgChevronRightStroke(props) {
|
|
30
|
-
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
31
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
32
|
-
width: 12,
|
|
33
|
-
height: 12,
|
|
34
|
-
focusable: "false",
|
|
35
|
-
viewBox: "0 0 12 12",
|
|
36
|
-
"aria-hidden": "true"
|
|
37
|
-
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
38
|
-
fill: "currentColor",
|
|
39
|
-
d: "M3.646 10.354a.5.5 0 01-.057-.638l.057-.07L7.293 6 3.646 2.354a.5.5 0 01-.057-.638l.057-.07a.5.5 0 01.638-.057l.07.057 4 4a.5.5 0 01.057.638l-.057.07-4 4a.5.5 0 01-.708 0z"
|
|
40
|
-
})));
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const ValidChevronIcon = props => {
|
|
44
|
-
const {
|
|
45
|
-
theme,
|
|
46
|
-
...validProps
|
|
47
|
-
} = props;
|
|
48
|
-
return React__default.createElement(SvgChevronRightStroke, validProps);
|
|
49
|
-
};
|
|
50
|
-
const StyledChevronIcon = styled(ValidChevronIcon).attrs({
|
|
51
|
-
role: 'presentation',
|
|
52
|
-
'aria-hidden': 'true'
|
|
53
|
-
}).withConfig({
|
|
54
|
-
displayName: "StyledChevronIcon",
|
|
55
|
-
componentId: "sc-9r9qrm-0"
|
|
56
|
-
})(["transform:", ";margin:0 ", ";color:", ";"], props => props.theme.rtl && `rotate(180deg);`, props => em(props.theme.space.base, props.theme.fontSizes.md), props => getColor('neutralHue', 600, props.theme));
|
|
57
|
-
StyledChevronIcon.defaultProps = {
|
|
58
|
-
theme: DEFAULT_THEME
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const COMPONENT_ID = 'breadcrumbs.item';
|
|
62
|
-
const linkStyles = _ref => {
|
|
63
|
-
let {
|
|
64
|
-
isCurrent
|
|
65
|
-
} = _ref;
|
|
66
|
-
return css(["& > :link,& > :visited{white-space:inherit;}", ""], isCurrent && `
|
|
67
|
-
& > :link,
|
|
68
|
-
& > :visited,
|
|
69
|
-
& > :link:hover,
|
|
70
|
-
& > :visited:hover,
|
|
71
|
-
& > :link:focus,
|
|
72
|
-
& > :visited:focus {
|
|
73
|
-
color: inherit;
|
|
74
|
-
}
|
|
75
|
-
`);
|
|
76
|
-
};
|
|
77
|
-
const StyledBreadcrumbItem = styled.li.attrs({
|
|
78
|
-
'data-garden-id': COMPONENT_ID,
|
|
79
|
-
'data-garden-version': '9.0.0-next.2'
|
|
80
|
-
}).withConfig({
|
|
81
|
-
displayName: "StyledBreadcrumbItem",
|
|
82
|
-
componentId: "sc-r0suq7-0"
|
|
83
|
-
})(["line-height:", ";white-space:nowrap;color:", ";font-size:inherit;", ";", ";"], props => getLineHeight(props.theme.space.base * 5, props.theme.fontSizes.md), props => props.isCurrent ? getColor(props.theme.colors.neutralHue, 600) : 'inherit', linkStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
84
|
-
StyledBreadcrumbItem.defaultProps = {
|
|
85
|
-
theme: DEFAULT_THEME
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
const StyledCenteredBreadcrumbItem = styled(StyledBreadcrumbItem).attrs({
|
|
89
|
-
'aria-hidden': true
|
|
90
|
-
}).withConfig({
|
|
91
|
-
displayName: "StyledCenteredBreadcrumbItem",
|
|
92
|
-
componentId: "sc-1ces9y2-0"
|
|
93
|
-
})(["display:flex;align-items:center;"]);
|
|
94
|
-
StyledCenteredBreadcrumbItem.defaultProps = {
|
|
95
|
-
theme: DEFAULT_THEME
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
const Breadcrumb = forwardRef((props, ref) => {
|
|
99
|
-
const {
|
|
100
|
-
getContainerProps,
|
|
101
|
-
getCurrentPageProps
|
|
102
|
-
} = useBreadcrumb();
|
|
103
|
-
const totalChildren = Children.count(props.children);
|
|
104
|
-
const mappedChildren = Children.map(props.children, (child, index) => {
|
|
105
|
-
const isLastItem = index === totalChildren - 1;
|
|
106
|
-
if (isLastItem) {
|
|
107
|
-
return React__default.createElement(StyledBreadcrumbItem, {
|
|
108
|
-
isCurrent: true
|
|
109
|
-
}, cloneElement(child, getCurrentPageProps()));
|
|
110
|
-
}
|
|
111
|
-
return React__default.createElement(React__default.Fragment, null, React__default.createElement(StyledBreadcrumbItem, null, child), React__default.createElement(StyledCenteredBreadcrumbItem, null, React__default.createElement(StyledChevronIcon, null)));
|
|
112
|
-
});
|
|
113
|
-
const ariaLabel = useText(Breadcrumb, props, 'aria-label', 'Breadcrumbs');
|
|
114
|
-
return React__default.createElement("nav", getContainerProps({
|
|
115
|
-
...props,
|
|
116
|
-
ref,
|
|
117
|
-
role: null,
|
|
118
|
-
'aria-label': ariaLabel
|
|
119
|
-
}), React__default.createElement(StyledBreadcrumb, null, mappedChildren));
|
|
120
|
-
});
|
|
121
|
-
Breadcrumb.displayName = 'Breadcrumb';
|
|
122
|
-
|
|
123
|
-
export { Breadcrumb };
|