@zendeskgarden/react-chrome 9.0.0-next.15 → 9.0.0-next.17
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/Chrome.js +9 -8
- package/dist/esm/elements/header/HeaderItemIcon.js +2 -18
- package/dist/esm/elements/nav/Nav.js +13 -7
- package/dist/esm/elements/nav/NavItem.js +5 -11
- package/dist/esm/elements/nav/NavItemIcon.js +2 -18
- package/dist/esm/elements/sheet/Sheet.js +1 -1
- package/dist/esm/styled/StyledChrome.js +1 -1
- package/dist/esm/styled/StyledSkipNav.js +43 -15
- package/dist/esm/styled/StyledSkipNavIcon.js +10 -4
- package/dist/esm/styled/body/StyledBody.js +6 -3
- package/dist/esm/styled/body/StyledContent.js +18 -6
- package/dist/esm/styled/body/StyledMain.js +6 -3
- package/dist/esm/styled/footer/StyledFooter.js +28 -7
- package/dist/esm/styled/footer/StyledFooterItem.js +1 -1
- package/dist/esm/styled/header/StyledBaseHeaderItem.js +24 -15
- package/dist/esm/styled/header/StyledHeader.js +46 -12
- package/dist/esm/styled/header/StyledHeaderItem.js +46 -14
- package/dist/esm/styled/header/StyledHeaderItemIcon.js +13 -5
- package/dist/esm/styled/header/StyledHeaderItemText.js +5 -5
- package/dist/esm/styled/header/StyledHeaderItemWrapper.js +1 -1
- package/dist/esm/styled/header/StyledLogoHeaderItem.js +33 -21
- package/dist/esm/styled/nav/StyledBaseNavItem.js +12 -11
- package/dist/esm/styled/nav/StyledBrandmarkNavItem.js +2 -2
- package/dist/esm/styled/nav/StyledLogoNavItem.js +15 -22
- package/dist/esm/styled/nav/StyledNav.js +33 -13
- package/dist/esm/styled/nav/StyledNavButton.js +64 -35
- package/dist/esm/styled/nav/StyledNavItemIcon.js +12 -5
- package/dist/esm/styled/nav/StyledNavItemText.js +19 -14
- package/dist/esm/styled/nav/StyledNavList.js +1 -1
- package/dist/esm/styled/nav/StyledNavListItem.js +1 -1
- package/dist/esm/styled/sheet/StyledSheet.js +32 -17
- package/dist/esm/styled/sheet/StyledSheetBody.js +1 -1
- package/dist/esm/styled/sheet/StyledSheetClose.js +13 -16
- package/dist/esm/styled/sheet/StyledSheetDescription.js +6 -3
- package/dist/esm/styled/sheet/StyledSheetFooter.js +23 -4
- package/dist/esm/styled/sheet/StyledSheetFooterItem.js +1 -1
- package/dist/esm/styled/sheet/StyledSheetHeader.js +27 -5
- package/dist/esm/styled/sheet/StyledSheetTitle.js +6 -3
- package/dist/esm/styled/sheet/StyledSheetWrapper.js +21 -18
- package/dist/esm/styled/utils.js +20 -0
- package/dist/index.cjs.js +662 -403
- package/dist/typings/elements/header/HeaderItemIcon.d.ts +1 -1
- package/dist/typings/elements/nav/NavItemIcon.d.ts +1 -1
- package/dist/typings/styled/StyledSkipNav.d.ts +0 -3
- package/dist/typings/styled/StyledSkipNavIcon.d.ts +2 -2
- package/dist/typings/styled/body/StyledContent.d.ts +2 -1
- package/dist/typings/styled/footer/StyledFooter.d.ts +1 -2
- package/dist/typings/styled/header/StyledBaseHeaderItem.d.ts +1 -6
- package/dist/typings/styled/header/StyledHeader.d.ts +1 -2
- package/dist/typings/styled/header/StyledHeaderItem.d.ts +0 -3
- package/dist/typings/styled/header/StyledHeaderItemIcon.d.ts +3 -4
- package/dist/typings/styled/header/StyledHeaderItemText.d.ts +0 -1
- package/dist/typings/styled/header/StyledLogoHeaderItem.d.ts +2 -4
- package/dist/typings/styled/nav/StyledBaseNavItem.d.ts +1 -2
- package/dist/typings/styled/nav/StyledBrandmarkNavItem.d.ts +0 -3
- package/dist/typings/styled/nav/StyledLogoNavItem.d.ts +3 -7
- package/dist/typings/styled/nav/StyledNav.d.ts +2 -6
- package/dist/typings/styled/nav/StyledNavButton.d.ts +2 -13
- package/dist/typings/styled/nav/StyledNavItemIcon.d.ts +3 -4
- package/dist/typings/styled/nav/StyledNavItemText.d.ts +2 -1
- package/dist/typings/styled/sheet/StyledSheetClose.d.ts +4 -8
- package/dist/typings/styled/sheet/StyledSheetDescription.d.ts +2 -3
- package/dist/typings/styled/sheet/StyledSheetFooter.d.ts +2 -2
- package/dist/typings/styled/sheet/StyledSheetFooterItem.d.ts +2 -3
- package/dist/typings/styled/sheet/StyledSheetHeader.d.ts +2 -6
- package/dist/typings/styled/sheet/StyledSheetTitle.d.ts +2 -3
- package/dist/typings/styled/sheet/StyledSheetWrapper.d.ts +2 -2
- package/dist/typings/styled/utils.d.ts +15 -0
- package/dist/typings/utils/useChromeContext.d.ts +0 -1
- package/package.json +4 -3
|
@@ -8,7 +8,7 @@ import React__default, { useContext, useMemo, useEffect } from 'react';
|
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import { ThemeContext } from 'styled-components';
|
|
10
10
|
import { readableColor } from 'polished';
|
|
11
|
-
import {
|
|
11
|
+
import { DEFAULT_THEME, getColor, useDocument } from '@zendeskgarden/react-theming';
|
|
12
12
|
import { ChromeContext } from '../utils/useChromeContext.js';
|
|
13
13
|
import { StyledChrome } from '../styled/StyledChrome.js';
|
|
14
14
|
import '../styled/StyledSkipNav.js';
|
|
@@ -50,22 +50,23 @@ const Chrome = React__default.forwardRef((_ref, ref) => {
|
|
|
50
50
|
isFluid,
|
|
51
51
|
...props
|
|
52
52
|
} = _ref;
|
|
53
|
-
const theme = useContext(ThemeContext);
|
|
53
|
+
const theme = useContext(ThemeContext) || DEFAULT_THEME;
|
|
54
54
|
const isLightMemoized = useMemo(() => {
|
|
55
55
|
if (hue) {
|
|
56
|
-
const backgroundColor =
|
|
56
|
+
const backgroundColor = getColor({
|
|
57
|
+
theme,
|
|
58
|
+
hue
|
|
59
|
+
});
|
|
57
60
|
const LIGHT_COLOR = 'white';
|
|
58
61
|
return readableColor(backgroundColor, LIGHT_COLOR, undefined, false ) === LIGHT_COLOR;
|
|
59
62
|
}
|
|
60
63
|
return false;
|
|
61
64
|
}, [hue, theme]);
|
|
62
|
-
const isLight = hue ? isLightMemoized :
|
|
63
|
-
const isDark = hue ? !isLightMemoized : false;
|
|
65
|
+
const isLight = hue ? isLightMemoized : undefined;
|
|
64
66
|
const chromeContextValue = useMemo(() => ({
|
|
65
67
|
hue: hue || 'chromeHue',
|
|
66
|
-
isLight
|
|
67
|
-
|
|
68
|
-
}), [hue, isLight, isDark]);
|
|
68
|
+
isLight
|
|
69
|
+
}), [hue, isLight]);
|
|
69
70
|
const environment = useDocument(theme);
|
|
70
71
|
useEffect(() => {
|
|
71
72
|
if (environment && !isFluid) {
|
|
@@ -4,7 +4,7 @@
|
|
|
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 React__default
|
|
7
|
+
import React__default from 'react';
|
|
8
8
|
import '../../styled/StyledChrome.js';
|
|
9
9
|
import '../../styled/StyledSkipNav.js';
|
|
10
10
|
import '../../styled/StyledSkipNavIcon.js';
|
|
@@ -44,23 +44,7 @@ const HeaderItemIcon = _ref => {
|
|
|
44
44
|
children,
|
|
45
45
|
...props
|
|
46
46
|
} = _ref;
|
|
47
|
-
|
|
48
|
-
if ( isValidElement(element)) {
|
|
49
|
-
const Icon = _ref2 => {
|
|
50
|
-
let {
|
|
51
|
-
theme,
|
|
52
|
-
...iconProps
|
|
53
|
-
} = _ref2;
|
|
54
|
-
return cloneElement(element, {
|
|
55
|
-
...props,
|
|
56
|
-
...iconProps
|
|
57
|
-
});
|
|
58
|
-
};
|
|
59
|
-
return React__default.createElement(StyledHeaderItemIcon, Object.assign({
|
|
60
|
-
as: Icon
|
|
61
|
-
}, props));
|
|
62
|
-
}
|
|
63
|
-
return null;
|
|
47
|
+
return React__default.createElement(StyledHeaderItemIcon, props, children);
|
|
64
48
|
};
|
|
65
49
|
|
|
66
50
|
export { HeaderItemIcon };
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import React__default, { useMemo } from 'react';
|
|
8
|
+
import { ThemeProvider } from 'styled-components';
|
|
8
9
|
import PropTypes from 'prop-types';
|
|
9
10
|
import { useChromeContext } from '../../utils/useChromeContext.js';
|
|
10
11
|
import { NavContext } from '../../utils/useNavContext.js';
|
|
@@ -49,21 +50,26 @@ import { NavList } from './NavList.js';
|
|
|
49
50
|
const NavComponent = React__default.forwardRef((props, ref) => {
|
|
50
51
|
const {
|
|
51
52
|
hue,
|
|
52
|
-
isLight
|
|
53
|
-
isDark
|
|
53
|
+
isLight
|
|
54
54
|
} = useChromeContext();
|
|
55
55
|
const navContextValue = useMemo(() => ({
|
|
56
56
|
isExpanded: !!props.isExpanded
|
|
57
57
|
}), [props.isExpanded]);
|
|
58
|
-
return React__default.createElement(
|
|
58
|
+
return React__default.createElement(ThemeProvider, {
|
|
59
|
+
theme: parentTheme => ({
|
|
60
|
+
...parentTheme,
|
|
61
|
+
colors: {
|
|
62
|
+
...parentTheme.colors,
|
|
63
|
+
base: isLight ? 'light' : 'dark'
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
}, React__default.createElement(NavContext.Provider, {
|
|
59
67
|
value: navContextValue
|
|
60
68
|
}, React__default.createElement(StyledNav, Object.assign({
|
|
61
69
|
ref: ref
|
|
62
70
|
}, props, {
|
|
63
|
-
hue: hue
|
|
64
|
-
|
|
65
|
-
isDark: isDark
|
|
66
|
-
})));
|
|
71
|
+
hue: hue
|
|
72
|
+
}))));
|
|
67
73
|
});
|
|
68
74
|
NavComponent.displayName = 'Nav';
|
|
69
75
|
NavComponent.propTypes = {
|
|
@@ -49,27 +49,23 @@ const NavItem = React__default.forwardRef((_ref, ref) => {
|
|
|
49
49
|
hasLogo,
|
|
50
50
|
hasBrandmark,
|
|
51
51
|
product,
|
|
52
|
+
isCurrent,
|
|
52
53
|
...other
|
|
53
54
|
} = _ref;
|
|
54
55
|
const {
|
|
55
|
-
hue
|
|
56
|
-
isLight,
|
|
57
|
-
isDark
|
|
56
|
+
hue
|
|
58
57
|
} = useChromeContext();
|
|
59
58
|
const {
|
|
60
59
|
isExpanded
|
|
61
60
|
} = useNavContext();
|
|
62
61
|
const navListContext = useNavListContext();
|
|
63
|
-
const ariaCurrent = other.isCurrent || undefined;
|
|
64
62
|
const hasList = navListContext?.hasList;
|
|
65
63
|
let retVal;
|
|
66
64
|
if (hasLogo) {
|
|
67
65
|
retVal = React__default.createElement(StyledLogoNavItem, Object.assign({
|
|
68
66
|
ref: ref,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
product: product,
|
|
72
|
-
"aria-current": ariaCurrent
|
|
67
|
+
hue: hue,
|
|
68
|
+
product: product
|
|
73
69
|
}, other));
|
|
74
70
|
} else if (hasBrandmark) {
|
|
75
71
|
retVal = React__default.createElement(StyledBrandmarkNavItem, Object.assign({
|
|
@@ -81,9 +77,7 @@ const NavItem = React__default.forwardRef((_ref, ref) => {
|
|
|
81
77
|
ref: ref,
|
|
82
78
|
isExpanded: isExpanded,
|
|
83
79
|
hue: hue,
|
|
84
|
-
|
|
85
|
-
isLight: isLight,
|
|
86
|
-
"aria-current": ariaCurrent
|
|
80
|
+
"aria-current": isCurrent || undefined
|
|
87
81
|
}, other));
|
|
88
82
|
}
|
|
89
83
|
if (hasList) {
|
|
@@ -4,7 +4,7 @@
|
|
|
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 React__default
|
|
7
|
+
import React__default from 'react';
|
|
8
8
|
import '../../styled/StyledChrome.js';
|
|
9
9
|
import '../../styled/StyledSkipNav.js';
|
|
10
10
|
import '../../styled/StyledSkipNavIcon.js';
|
|
@@ -44,23 +44,7 @@ const NavItemIcon = _ref => {
|
|
|
44
44
|
children,
|
|
45
45
|
...props
|
|
46
46
|
} = _ref;
|
|
47
|
-
|
|
48
|
-
if ( isValidElement(element)) {
|
|
49
|
-
const Icon = _ref2 => {
|
|
50
|
-
let {
|
|
51
|
-
theme,
|
|
52
|
-
...iconProps
|
|
53
|
-
} = _ref2;
|
|
54
|
-
return cloneElement(element, {
|
|
55
|
-
...props,
|
|
56
|
-
...iconProps
|
|
57
|
-
});
|
|
58
|
-
};
|
|
59
|
-
return React__default.createElement(StyledNavItemIcon, Object.assign({
|
|
60
|
-
as: Icon
|
|
61
|
-
}, props));
|
|
62
|
-
}
|
|
63
|
-
return null;
|
|
47
|
+
return React__default.createElement(StyledNavItemIcon, props, children);
|
|
64
48
|
};
|
|
65
49
|
|
|
66
50
|
export { NavItemIcon };
|
|
@@ -67,7 +67,7 @@ const SheetComponent = React__default.forwardRef((_ref, ref) => {
|
|
|
67
67
|
const sheetRef = useRef(null);
|
|
68
68
|
const seed = useUIDSeed();
|
|
69
69
|
const [isCloseButtonPresent, setIsCloseButtonPresent] = useState(false);
|
|
70
|
-
const idPrefix = useMemo(() => id || seed(`sheet_${'9.0.0-next.
|
|
70
|
+
const idPrefix = useMemo(() => id || seed(`sheet_${'9.0.0-next.17'}`), [id, seed]);
|
|
71
71
|
const titleId = `${idPrefix}--title`;
|
|
72
72
|
const descriptionId = `${idPrefix}--description`;
|
|
73
73
|
const sheetContext = useMemo(() => ({
|
|
@@ -10,7 +10,7 @@ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-the
|
|
|
10
10
|
const COMPONENT_ID = 'chrome.chrome';
|
|
11
11
|
const StyledChrome = styled.div.attrs({
|
|
12
12
|
'data-garden-id': COMPONENT_ID,
|
|
13
|
-
'data-garden-version': '9.0.0-next.
|
|
13
|
+
'data-garden-version': '9.0.0-next.17'
|
|
14
14
|
}).withConfig({
|
|
15
15
|
displayName: "StyledChrome",
|
|
16
16
|
componentId: "sc-1uqm6u6-0"
|
|
@@ -6,39 +6,67 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import styled, { keyframes, css } from 'styled-components';
|
|
8
8
|
import { math } from 'polished';
|
|
9
|
-
import { SELECTOR_FOCUS_VISIBLE, retrieveComponentStyles, DEFAULT_THEME,
|
|
10
|
-
import { getHeaderHeight } from './
|
|
9
|
+
import { SELECTOR_FOCUS_VISIBLE, retrieveComponentStyles, DEFAULT_THEME, getColor, focusStyles, getLineHeight } from '@zendeskgarden/react-theming';
|
|
10
|
+
import { getHeaderHeight } from './utils.js';
|
|
11
11
|
|
|
12
12
|
const COMPONENT_ID = 'chrome.skipnav';
|
|
13
13
|
const animationStyles = () => {
|
|
14
14
|
const animationName = keyframes(["0%{transform:translate(-50%,-50%);}"]);
|
|
15
15
|
return css(["transition:opacity 0.2s ease-out,clip 0s linear 0.2s;opacity:0;clip:rect(0,0,0,0);&:focus{transition:opacity 0.2s ease-in-out;animation:0.2s cubic-bezier(0.15,0.85,0.35,1.2) ", ";opacity:1;clip:rect(0,150vw,100vh,-50vw);}"], animationName);
|
|
16
16
|
};
|
|
17
|
-
const colorStyles =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
const colorStyles = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
theme
|
|
20
|
+
} = _ref;
|
|
21
|
+
const backgroundColor = getColor({
|
|
22
|
+
theme,
|
|
23
|
+
variable: 'background.raised'
|
|
24
|
+
});
|
|
25
|
+
const borderColor = getColor({
|
|
26
|
+
theme,
|
|
27
|
+
variable: 'border.default'
|
|
28
|
+
});
|
|
29
|
+
const boxShadowColor = getColor({
|
|
30
|
+
theme,
|
|
31
|
+
hue: 'neutralHue',
|
|
32
|
+
shade: 1200,
|
|
33
|
+
dark: {
|
|
34
|
+
transparency: theme.opacity[800]
|
|
35
|
+
},
|
|
36
|
+
light: {
|
|
37
|
+
transparency: theme.opacity[200]
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
const boxShadow = theme.shadows.lg(`${theme.space.base * 4}px`, `${theme.space.base * 6}px`, boxShadowColor);
|
|
41
|
+
const foregroundColor = getColor({
|
|
42
|
+
theme,
|
|
43
|
+
variable: 'foreground.primary'
|
|
44
|
+
});
|
|
45
|
+
return css(["border-color:", ";box-shadow:", ";background-color:", ";color:", ";&:hover,&:focus{color:", ";}", ""], borderColor, boxShadow, backgroundColor, foregroundColor, foregroundColor, focusStyles({
|
|
22
46
|
theme,
|
|
23
47
|
inset: true,
|
|
24
48
|
boxShadow
|
|
25
49
|
}));
|
|
26
50
|
};
|
|
27
|
-
const sizeStyles =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const
|
|
51
|
+
const sizeStyles = _ref2 => {
|
|
52
|
+
let {
|
|
53
|
+
theme
|
|
54
|
+
} = _ref2;
|
|
55
|
+
const top = math(`${getHeaderHeight(theme)} / 2`);
|
|
56
|
+
const border = theme.borders.sm;
|
|
57
|
+
const padding = `${theme.space.base * 5}px`;
|
|
58
|
+
const paddingStart = `${theme.space.base * 4}px`;
|
|
59
|
+
const fontSize = theme.fontSizes.md;
|
|
32
60
|
const lineHeight = getLineHeight(padding, fontSize);
|
|
33
|
-
return css(["top:", ";padding:", ";padding-", ":", ";line-height:", ";font-size:", ";"], top, padding,
|
|
61
|
+
return css(["top:", ";border:", ";padding:", ";padding-", ":", ";line-height:", ";font-size:", ";"], top, border, padding, theme.rtl ? 'right' : 'left', paddingStart, lineHeight, fontSize);
|
|
34
62
|
};
|
|
35
63
|
const StyledSkipNav = styled.a.attrs({
|
|
36
64
|
'data-garden-id': COMPONENT_ID,
|
|
37
|
-
'data-garden-version': '9.0.0-next.
|
|
65
|
+
'data-garden-version': '9.0.0-next.17'
|
|
38
66
|
}).withConfig({
|
|
39
67
|
displayName: "StyledSkipNav",
|
|
40
68
|
componentId: "sc-1tsro34-0"
|
|
41
|
-
})(["", ";display:inline-flex;position:absolute;left:50%;align-items:center;justify-content:center;transform:translateX(-50%);direction:", ";z-index:", ";border
|
|
69
|
+
})(["", ";display:inline-flex;position:absolute;left:50%;align-items:center;justify-content:center;transform:translateX(-50%);direction:", ";z-index:", ";border-radius:", ";text-decoration:underline;white-space:nowrap;", ";", "{text-decoration:none;}&:hover{text-decoration:underline;}", ";", ";"], animationStyles(), props => props.theme.rtl && 'rtl', props => props.zIndex, props => props.theme.borderRadii.md, sizeStyles, SELECTOR_FOCUS_VISIBLE, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
42
70
|
StyledSkipNav.defaultProps = {
|
|
43
71
|
theme: DEFAULT_THEME
|
|
44
72
|
};
|
|
@@ -6,21 +6,27 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import styled, { css } from 'styled-components';
|
|
8
8
|
import SvgLinkStroke from '../node_modules/@zendeskgarden/svg-icons/src/16/link-stroke.svg.js';
|
|
9
|
-
import {
|
|
9
|
+
import { getColor, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
10
10
|
|
|
11
11
|
const COMPONENT_ID = 'chrome.skipnav_icon';
|
|
12
|
-
const sizeStyles =
|
|
12
|
+
const sizeStyles = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
theme
|
|
15
|
+
} = _ref;
|
|
13
16
|
const margin = `${theme.space.base * 2}px`;
|
|
14
17
|
const size = theme.iconSizes.md;
|
|
15
18
|
return css(["margin-", ":", ";width:", ";height:", ";"], theme.rtl ? 'left' : 'right', margin, size, size);
|
|
16
19
|
};
|
|
17
20
|
const StyledSkipNavIcon = styled(SvgLinkStroke).attrs({
|
|
18
21
|
'data-garden-id': COMPONENT_ID,
|
|
19
|
-
'data-garden-version': '9.0.0-next.
|
|
22
|
+
'data-garden-version': '9.0.0-next.17'
|
|
20
23
|
}).withConfig({
|
|
21
24
|
displayName: "StyledSkipNavIcon",
|
|
22
25
|
componentId: "sc-1ika5z4-0"
|
|
23
|
-
})(["transform:", ";color:", ";", ";", ";"],
|
|
26
|
+
})(["transform:", ";color:", ";", ";", ";"], p => p.theme.rtl && 'scaleX(-1)', p => getColor({
|
|
27
|
+
theme: p.theme,
|
|
28
|
+
variable: 'foreground.subtle'
|
|
29
|
+
}), sizeStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
24
30
|
StyledSkipNavIcon.defaultProps = {
|
|
25
31
|
theme: DEFAULT_THEME
|
|
26
32
|
};
|
|
@@ -5,16 +5,19 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import styled from 'styled-components';
|
|
8
|
-
import {
|
|
8
|
+
import { getColor, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
9
|
|
|
10
10
|
const COMPONENT_ID = 'chrome.body';
|
|
11
11
|
const StyledBody = styled.div.attrs({
|
|
12
12
|
'data-garden-id': COMPONENT_ID,
|
|
13
|
-
'data-garden-version': '9.0.0-next.
|
|
13
|
+
'data-garden-version': '9.0.0-next.17'
|
|
14
14
|
}).withConfig({
|
|
15
15
|
displayName: "StyledBody",
|
|
16
16
|
componentId: "sc-c7h9kv-0"
|
|
17
|
-
})(["flex:1;order:1;background-color:", ";min-width:0;", ";"], props =>
|
|
17
|
+
})(["flex:1;order:1;background-color:", ";min-width:0;", ";"], props => getColor({
|
|
18
|
+
theme: props.theme,
|
|
19
|
+
variable: 'background.default'
|
|
20
|
+
}), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
18
21
|
StyledBody.defaultProps = {
|
|
19
22
|
theme: DEFAULT_THEME
|
|
20
23
|
};
|
|
@@ -4,20 +4,32 @@
|
|
|
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 styled from 'styled-components';
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
8
|
import { math } from 'polished';
|
|
9
|
-
import {
|
|
10
|
-
import { getHeaderHeight } from '../
|
|
11
|
-
import { getFooterHeight } from '../footer/StyledFooter.js';
|
|
9
|
+
import { getColor, retrieveComponentStyles, DEFAULT_THEME, getLineHeight } from '@zendeskgarden/react-theming';
|
|
10
|
+
import { getHeaderHeight, getFooterHeight } from '../utils.js';
|
|
12
11
|
|
|
13
12
|
const COMPONENT_ID = 'chrome.content';
|
|
13
|
+
const sizeStyles = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
theme,
|
|
16
|
+
hasFooter
|
|
17
|
+
} = _ref;
|
|
18
|
+
const fontSize = theme.fontSizes.md;
|
|
19
|
+
const height = hasFooter ? `calc(100% - ${math(`${getHeaderHeight(theme)} + ${getFooterHeight(theme)}`)})` : `calc(100% - ${getHeaderHeight(theme)})`;
|
|
20
|
+
const lineHeight = getLineHeight(theme.lineHeights.md, theme.fontSizes.md);
|
|
21
|
+
return css(["height:", ";line-height:", ";font-size:", ";"], height, lineHeight, fontSize);
|
|
22
|
+
};
|
|
14
23
|
const StyledContent = styled.div.attrs({
|
|
15
24
|
'data-garden-id': COMPONENT_ID,
|
|
16
|
-
'data-garden-version': '9.0.0-next.
|
|
25
|
+
'data-garden-version': '9.0.0-next.17'
|
|
17
26
|
}).withConfig({
|
|
18
27
|
displayName: "StyledContent",
|
|
19
28
|
componentId: "sc-qcuzxn-0"
|
|
20
|
-
})(["display:flex;
|
|
29
|
+
})(["display:flex;color:", ";", ";&:focus{outline:none;}", ";"], props => getColor({
|
|
30
|
+
theme: props.theme,
|
|
31
|
+
variable: 'foreground.default'
|
|
32
|
+
}), sizeStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
21
33
|
StyledContent.defaultProps = {
|
|
22
34
|
theme: DEFAULT_THEME
|
|
23
35
|
};
|
|
@@ -5,16 +5,19 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import styled from 'styled-components';
|
|
8
|
-
import {
|
|
8
|
+
import { getColor, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
9
|
|
|
10
10
|
const COMPONENT_ID = 'chrome.main';
|
|
11
11
|
const StyledMain = styled.main.attrs({
|
|
12
12
|
'data-garden-id': COMPONENT_ID,
|
|
13
|
-
'data-garden-version': '9.0.0-next.
|
|
13
|
+
'data-garden-version': '9.0.0-next.17'
|
|
14
14
|
}).withConfig({
|
|
15
15
|
displayName: "StyledMain",
|
|
16
16
|
componentId: "sc-t61cre-0"
|
|
17
|
-
})(["flex:1;order:1;background-color:", ";overflow:auto;:focus{outline:none;}", ";"], props =>
|
|
17
|
+
})(["flex:1;order:1;background-color:", ";overflow:auto;:focus{outline:none;}", ";"], props => getColor({
|
|
18
|
+
theme: props.theme,
|
|
19
|
+
variable: 'background.default'
|
|
20
|
+
}), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
18
21
|
StyledMain.defaultProps = {
|
|
19
22
|
theme: DEFAULT_THEME
|
|
20
23
|
};
|
|
@@ -4,22 +4,43 @@
|
|
|
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 styled from 'styled-components';
|
|
8
|
-
import {
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { getFooterHeight } from '../utils.js';
|
|
9
10
|
|
|
10
11
|
const COMPONENT_ID = 'chrome.footer';
|
|
11
|
-
const
|
|
12
|
-
|
|
12
|
+
const colorStyles = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
theme
|
|
15
|
+
} = _ref;
|
|
16
|
+
const backgroundColor = getColor({
|
|
17
|
+
theme,
|
|
18
|
+
variable: 'background.default'
|
|
19
|
+
});
|
|
20
|
+
const borderColor = getColor({
|
|
21
|
+
theme,
|
|
22
|
+
variable: 'border.default'
|
|
23
|
+
});
|
|
24
|
+
return css(["border-top-color:", ";background-color:", ";"], borderColor, backgroundColor);
|
|
25
|
+
};
|
|
26
|
+
const sizeStyles = _ref2 => {
|
|
27
|
+
let {
|
|
28
|
+
theme
|
|
29
|
+
} = _ref2;
|
|
30
|
+
const border = theme.borders.sm;
|
|
31
|
+
const padding = `0 ${theme.space.base * 9}px`;
|
|
32
|
+
const height = getFooterHeight(theme);
|
|
33
|
+
return css(["box-sizing:border-box;border-top:", ";padding:", ";height:", ";"], border, padding, height);
|
|
13
34
|
};
|
|
14
35
|
const StyledFooter = styled.footer.attrs({
|
|
15
36
|
'data-garden-id': COMPONENT_ID,
|
|
16
|
-
'data-garden-version': '9.0.0-next.
|
|
37
|
+
'data-garden-version': '9.0.0-next.17'
|
|
17
38
|
}).withConfig({
|
|
18
39
|
displayName: "StyledFooter",
|
|
19
40
|
componentId: "sc-v7lib2-0"
|
|
20
|
-
})(["display:flex;align-items:center;justify-content:flex-end;
|
|
41
|
+
})(["display:flex;align-items:center;justify-content:flex-end;", ";", ";", ";"], sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
21
42
|
StyledFooter.defaultProps = {
|
|
22
43
|
theme: DEFAULT_THEME
|
|
23
44
|
};
|
|
24
45
|
|
|
25
|
-
export { StyledFooter
|
|
46
|
+
export { StyledFooter };
|
|
@@ -10,7 +10,7 @@ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-the
|
|
|
10
10
|
const COMPONENT_ID = 'chrome.footer_item';
|
|
11
11
|
const StyledFooterItem = styled.div.attrs({
|
|
12
12
|
'data-garden-id': COMPONENT_ID,
|
|
13
|
-
'data-garden-version': '9.0.0-next.
|
|
13
|
+
'data-garden-version': '9.0.0-next.17'
|
|
14
14
|
}).withConfig({
|
|
15
15
|
displayName: "StyledFooterItem",
|
|
16
16
|
componentId: "sc-1cktm85-0"
|
|
@@ -6,30 +6,39 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import styled, { css } from 'styled-components';
|
|
8
8
|
import { retrieveComponentStyles, DEFAULT_THEME, getLineHeight } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { getHeaderItemSize } from '../utils.js';
|
|
9
10
|
|
|
10
11
|
const COMPONENT_ID = 'chrome.base_header_item';
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
const sizeStyles = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
theme,
|
|
15
|
+
maxY,
|
|
16
|
+
isRound
|
|
17
|
+
} = _ref;
|
|
18
|
+
const margin = `0 ${theme.space.base * 3}px`;
|
|
19
|
+
const size = getHeaderItemSize(theme);
|
|
20
|
+
const height = maxY ? '100%' : size;
|
|
21
|
+
const lineHeight = getLineHeight(size, theme.fontSizes.md);
|
|
22
|
+
const padding = `0 ${theme.space.base * 0.75}px`;
|
|
23
|
+
let borderRadius;
|
|
24
|
+
if (isRound) {
|
|
25
|
+
borderRadius = '100%';
|
|
26
|
+
} else if (maxY) {
|
|
27
|
+
borderRadius = '0';
|
|
28
|
+
} else {
|
|
29
|
+
borderRadius = theme.borderRadii.md;
|
|
30
|
+
}
|
|
31
|
+
return css(["margin:", ";border-radius:", ";padding:", ";min-width:", ";height:", ";line-height:", ";font-size:inherit;"], margin, borderRadius, padding, size, height, lineHeight);
|
|
15
32
|
};
|
|
16
33
|
const StyledBaseHeaderItem = styled.button.attrs({
|
|
17
34
|
'data-garden-id': COMPONENT_ID,
|
|
18
|
-
'data-garden-version': '9.0.0-next.
|
|
35
|
+
'data-garden-version': '9.0.0-next.17'
|
|
19
36
|
}).withConfig({
|
|
20
37
|
displayName: "StyledBaseHeaderItem",
|
|
21
38
|
componentId: "sc-1qua7h6-0"
|
|
22
|
-
})(["display:inline-flex;position:relative;flex:", ";align-items:center;justify-content:", ";order:1;transition:box-shadow 0.1s ease-in-out,color 0.1s ease-in-out;z-index:0;
|
|
23
|
-
if (props.isRound) {
|
|
24
|
-
return '100%';
|
|
25
|
-
}
|
|
26
|
-
if (props.maxY) {
|
|
27
|
-
return '0';
|
|
28
|
-
}
|
|
29
|
-
return props.theme.borderRadii.md;
|
|
30
|
-
}, sizeStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
39
|
+
})(["display:inline-flex;position:relative;flex:", ";align-items:center;justify-content:", ";order:1;transition:box-shadow 0.1s ease-in-out,color 0.1s ease-in-out;z-index:0;border:none;background:transparent;text-decoration:none;white-space:nowrap;color:inherit;", ";", ";"], props => props.maxX && '1', props => props.maxX ? 'start' : 'center', sizeStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
31
40
|
StyledBaseHeaderItem.defaultProps = {
|
|
32
41
|
theme: DEFAULT_THEME
|
|
33
42
|
};
|
|
34
43
|
|
|
35
|
-
export { StyledBaseHeaderItem
|
|
44
|
+
export { StyledBaseHeaderItem };
|
|
@@ -4,28 +4,62 @@
|
|
|
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 styled from 'styled-components';
|
|
8
|
-
import {
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
|
|
9
9
|
import { StyledLogoHeaderItem } from './StyledLogoHeaderItem.js';
|
|
10
|
-
import {
|
|
10
|
+
import { getHeaderHeight } from '../utils.js';
|
|
11
11
|
|
|
12
12
|
const COMPONENT_ID = 'chrome.header';
|
|
13
|
-
const
|
|
14
|
-
|
|
13
|
+
const colorStyles = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
theme,
|
|
16
|
+
isStandalone
|
|
17
|
+
} = _ref;
|
|
18
|
+
const backgroundColor = getColor({
|
|
19
|
+
theme,
|
|
20
|
+
variable: 'background.default'
|
|
21
|
+
});
|
|
22
|
+
const borderColor = getColor({
|
|
23
|
+
theme,
|
|
24
|
+
variable: 'border.default'
|
|
25
|
+
});
|
|
26
|
+
const boxShadowColor = getColor({
|
|
27
|
+
hue: 'neutralHue',
|
|
28
|
+
shade: 1200,
|
|
29
|
+
light: {
|
|
30
|
+
transparency: theme.opacity[200]
|
|
31
|
+
},
|
|
32
|
+
dark: {
|
|
33
|
+
transparency: theme.opacity[1100]
|
|
34
|
+
},
|
|
35
|
+
theme
|
|
36
|
+
});
|
|
37
|
+
const boxShadow = isStandalone ? theme.shadows.lg('0', `${theme.space.base * 2}px`, boxShadowColor) : undefined;
|
|
38
|
+
const foregroundColor = getColor({
|
|
39
|
+
theme,
|
|
40
|
+
variable: 'foreground.subtle'
|
|
41
|
+
});
|
|
42
|
+
return css(["border-bottom-color:", ";box-shadow:", ";background-color:", ";color:", ";"], borderColor, boxShadow, backgroundColor, foregroundColor);
|
|
43
|
+
};
|
|
44
|
+
const sizeStyles = _ref2 => {
|
|
45
|
+
let {
|
|
46
|
+
theme
|
|
47
|
+
} = _ref2;
|
|
48
|
+
const border = theme.borders.sm;
|
|
49
|
+
const padding = `0 ${theme.space.base}px`;
|
|
50
|
+
const fontSize = theme.fontSizes.md;
|
|
51
|
+
const height = getHeaderHeight(theme);
|
|
52
|
+
return css(["box-sizing:border-box;border-bottom:", ";padding:", ";height:", ";font-size:", ";"], border, padding, height, fontSize);
|
|
15
53
|
};
|
|
16
54
|
const StyledHeader = styled.header.attrs({
|
|
17
55
|
'data-garden-id': COMPONENT_ID,
|
|
18
|
-
'data-garden-version': '9.0.0-next.
|
|
56
|
+
'data-garden-version': '9.0.0-next.17'
|
|
19
57
|
}).withConfig({
|
|
20
58
|
displayName: "StyledHeader",
|
|
21
59
|
componentId: "sc-1cexpz-0"
|
|
22
|
-
})(["display:flex;position:", ";align-items:center;justify-content:flex-end;
|
|
23
|
-
${StyledLogoHeaderItem} {
|
|
24
|
-
display: inline-flex;
|
|
25
|
-
}
|
|
26
|
-
`, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
60
|
+
})(["display:flex;position:", ";align-items:center;justify-content:flex-end;", ";", ";", "{display:", ";}", ";"], props => props.isStandalone && 'relative', sizeStyles, colorStyles, StyledLogoHeaderItem, props => props.isStandalone && 'inline-flex', props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
27
61
|
StyledHeader.defaultProps = {
|
|
28
62
|
theme: DEFAULT_THEME
|
|
29
63
|
};
|
|
30
64
|
|
|
31
|
-
export { StyledHeader
|
|
65
|
+
export { StyledHeader };
|