@zendeskgarden/react-chrome 9.0.0-next.9 → 9.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/elements/Chrome.js +9 -8
- package/dist/esm/elements/SkipNav.js +1 -1
- package/dist/esm/elements/body/Content.js +1 -1
- package/dist/esm/elements/footer/FooterItem.js +1 -1
- package/dist/esm/elements/header/Header.js +10 -3
- package/dist/esm/elements/header/HeaderItem.js +12 -3
- package/dist/esm/elements/header/HeaderItemIcon.js +3 -18
- package/dist/esm/elements/header/HeaderItemText.js +11 -4
- package/dist/esm/elements/header/HeaderItemWrapper.js +1 -1
- package/dist/esm/elements/nav/Nav.js +22 -12
- package/dist/esm/elements/nav/NavItem.js +8 -14
- package/dist/esm/elements/nav/NavItemIcon.js +3 -18
- package/dist/esm/elements/nav/NavItemText.js +9 -4
- package/dist/esm/elements/nav/NavList.js +1 -1
- package/dist/esm/elements/sheet/Sheet.js +10 -9
- package/dist/esm/elements/sheet/components/Footer.js +8 -3
- package/dist/esm/elements/sheet/components/Header.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/link-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/x-stroke.svg.js +1 -1
- package/dist/esm/styled/StyledChrome.js +2 -5
- package/dist/esm/styled/StyledSkipNav.js +36 -18
- package/dist/esm/styled/StyledSkipNavIcon.js +10 -7
- package/dist/esm/styled/body/StyledBody.js +6 -6
- package/dist/esm/styled/body/StyledContent.js +18 -9
- package/dist/esm/styled/body/StyledMain.js +6 -6
- package/dist/esm/styled/footer/StyledFooter.js +28 -10
- package/dist/esm/styled/footer/StyledFooterItem.js +2 -5
- package/dist/esm/styled/header/StyledBaseHeaderItem.js +25 -19
- package/dist/esm/styled/header/StyledHeader.js +39 -15
- package/dist/esm/styled/header/StyledHeaderItem.js +46 -17
- package/dist/esm/styled/header/StyledHeaderItemIcon.js +13 -8
- package/dist/esm/styled/header/StyledHeaderItemText.js +6 -9
- package/dist/esm/styled/header/StyledHeaderItemWrapper.js +2 -5
- package/dist/esm/styled/header/StyledLogoHeaderItem.js +33 -24
- package/dist/esm/styled/nav/StyledBaseNavItem.js +12 -15
- package/dist/esm/styled/nav/StyledBrandmarkNavItem.js +2 -6
- package/dist/esm/styled/nav/StyledLogoNavItem.js +15 -25
- package/dist/esm/styled/nav/StyledNav.js +33 -16
- package/dist/esm/styled/nav/StyledNavButton.js +65 -39
- package/dist/esm/styled/nav/StyledNavItemIcon.js +12 -8
- package/dist/esm/styled/nav/StyledNavItemText.js +19 -17
- package/dist/esm/styled/nav/StyledNavList.js +2 -5
- package/dist/esm/styled/nav/StyledNavListItem.js +2 -5
- package/dist/esm/styled/sheet/StyledSheet.js +33 -21
- package/dist/esm/styled/sheet/StyledSheetBody.js +3 -6
- package/dist/esm/styled/sheet/StyledSheetClose.js +13 -19
- package/dist/esm/styled/sheet/StyledSheetDescription.js +6 -6
- package/dist/esm/styled/sheet/StyledSheetFooter.js +23 -7
- package/dist/esm/styled/sheet/StyledSheetFooterItem.js +2 -5
- package/dist/esm/styled/sheet/StyledSheetHeader.js +27 -8
- package/dist/esm/styled/sheet/StyledSheetTitle.js +6 -6
- package/dist/esm/styled/sheet/StyledSheetWrapper.js +22 -22
- package/dist/esm/styled/utils.js +20 -0
- package/dist/index.cjs.js +703 -517
- package/dist/typings/elements/footer/Footer.d.ts +1 -1
- package/dist/typings/elements/header/Header.d.ts +1 -1
- package/dist/typings/elements/header/HeaderItemIcon.d.ts +4 -1
- package/dist/typings/elements/nav/Nav.d.ts +1 -1
- package/dist/typings/elements/nav/NavItemIcon.d.ts +4 -1
- package/dist/typings/elements/sheet/Sheet.d.ts +3 -1
- package/dist/typings/styled/StyledSkipNav.d.ts +1 -4
- package/dist/typings/styled/StyledSkipNavIcon.d.ts +2 -2
- package/dist/typings/styled/body/StyledContent.d.ts +3 -2
- package/dist/typings/styled/footer/StyledFooter.d.ts +1 -2
- package/dist/typings/styled/header/StyledBaseHeaderItem.d.ts +4 -9
- package/dist/typings/styled/header/StyledHeader.d.ts +2 -3
- package/dist/typings/styled/header/StyledHeaderItem.d.ts +0 -3
- package/dist/typings/styled/header/StyledHeaderItemIcon.d.ts +2 -4
- package/dist/typings/styled/header/StyledHeaderItemText.d.ts +1 -2
- package/dist/typings/styled/header/StyledLogoHeaderItem.d.ts +3 -5
- 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 +4 -8
- package/dist/typings/styled/nav/StyledNav.d.ts +4 -8
- package/dist/typings/styled/nav/StyledNavButton.d.ts +4 -15
- package/dist/typings/styled/nav/StyledNavItemIcon.d.ts +2 -4
- package/dist/typings/styled/nav/StyledNavItemText.d.ts +4 -3
- package/dist/typings/styled/sheet/StyledSheet.d.ts +5 -4
- package/dist/typings/styled/sheet/StyledSheetClose.d.ts +3 -8
- package/dist/typings/styled/sheet/StyledSheetDescription.d.ts +2 -3
- package/dist/typings/styled/sheet/StyledSheetFooter.d.ts +3 -3
- package/dist/typings/styled/sheet/StyledSheetFooterItem.d.ts +2 -3
- package/dist/typings/styled/sheet/StyledSheetHeader.d.ts +3 -7
- package/dist/typings/styled/sheet/StyledSheetTitle.d.ts +2 -3
- package/dist/typings/styled/sheet/StyledSheetWrapper.d.ts +6 -6
- package/dist/typings/styled/utils.d.ts +15 -0
- package/dist/typings/utils/useChromeContext.d.ts +0 -1
- package/dist/typings/utils/useSheetContext.d.ts +0 -1
- package/package.json +8 -7
|
@@ -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) {
|
|
@@ -49,7 +49,7 @@ const SkipNav = React__default.forwardRef((_ref, ref) => {
|
|
|
49
49
|
} = _ref;
|
|
50
50
|
return React__default.createElement(StyledSkipNav, Object.assign({
|
|
51
51
|
href: `#${targetId}`,
|
|
52
|
-
zIndex: zIndex,
|
|
52
|
+
$zIndex: zIndex,
|
|
53
53
|
ref: ref
|
|
54
54
|
}, props), React__default.createElement(StyledSkipNavIcon, null), children);
|
|
55
55
|
});
|
|
@@ -46,7 +46,7 @@ const Content = React__default.forwardRef((props, ref) => {
|
|
|
46
46
|
} = useBodyContext() || {};
|
|
47
47
|
return React__default.createElement(StyledContent, Object.assign({
|
|
48
48
|
ref: ref,
|
|
49
|
-
hasFooter: hasFooter
|
|
49
|
+
$hasFooter: hasFooter
|
|
50
50
|
}, props));
|
|
51
51
|
});
|
|
52
52
|
Content.displayName = 'Content';
|
|
@@ -42,6 +42,6 @@ import '../../styled/sheet/StyledSheetHeader.js';
|
|
|
42
42
|
const FooterItem = React__default.forwardRef((props, ref) => React__default.createElement(StyledFooterItem, Object.assign({
|
|
43
43
|
ref: ref
|
|
44
44
|
}, props)));
|
|
45
|
-
FooterItem.displayName = '
|
|
45
|
+
FooterItem.displayName = 'Footer.Item';
|
|
46
46
|
|
|
47
47
|
export { FooterItem };
|
|
@@ -44,9 +44,16 @@ import { HeaderItemIcon } from './HeaderItemIcon.js';
|
|
|
44
44
|
import { HeaderItemText } from './HeaderItemText.js';
|
|
45
45
|
import { HeaderItemWrapper } from './HeaderItemWrapper.js';
|
|
46
46
|
|
|
47
|
-
const HeaderComponent = React__default.forwardRef((
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
const HeaderComponent = React__default.forwardRef((_ref, ref) => {
|
|
48
|
+
let {
|
|
49
|
+
isStandalone,
|
|
50
|
+
...other
|
|
51
|
+
} = _ref;
|
|
52
|
+
return React__default.createElement(StyledHeader, Object.assign({
|
|
53
|
+
ref: ref,
|
|
54
|
+
$isStandalone: isStandalone
|
|
55
|
+
}, other));
|
|
56
|
+
});
|
|
50
57
|
HeaderComponent.displayName = 'Header';
|
|
51
58
|
HeaderComponent.propTypes = {
|
|
52
59
|
isStandalone: PropTypes.bool
|
|
@@ -44,20 +44,29 @@ import '../../styled/sheet/StyledSheetHeader.js';
|
|
|
44
44
|
const HeaderItem = React__default.forwardRef((_ref, ref) => {
|
|
45
45
|
let {
|
|
46
46
|
hasLogo,
|
|
47
|
+
isRound,
|
|
48
|
+
maxX,
|
|
49
|
+
maxY,
|
|
47
50
|
product,
|
|
48
51
|
...other
|
|
49
52
|
} = _ref;
|
|
50
53
|
if (hasLogo) {
|
|
51
54
|
return React__default.createElement(StyledLogoHeaderItem, Object.assign({
|
|
52
55
|
ref: ref,
|
|
53
|
-
|
|
56
|
+
$isRound: isRound,
|
|
57
|
+
$maxX: maxX,
|
|
58
|
+
$maxY: maxY,
|
|
59
|
+
$product: product
|
|
54
60
|
}, other));
|
|
55
61
|
}
|
|
56
62
|
return React__default.createElement(StyledHeaderItem, Object.assign({
|
|
57
|
-
ref: ref
|
|
63
|
+
ref: ref,
|
|
64
|
+
$isRound: isRound,
|
|
65
|
+
$maxX: maxX,
|
|
66
|
+
$maxY: maxY
|
|
58
67
|
}, other));
|
|
59
68
|
});
|
|
60
|
-
HeaderItem.displayName = '
|
|
69
|
+
HeaderItem.displayName = 'Header.Item';
|
|
61
70
|
HeaderItem.propTypes = {
|
|
62
71
|
maxX: PropTypes.bool,
|
|
63
72
|
maxY: PropTypes.bool,
|
|
@@ -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,8 @@ 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
|
};
|
|
49
|
+
HeaderItemIcon.displayName = 'Header.ItemIcon';
|
|
65
50
|
|
|
66
51
|
export { HeaderItemIcon };
|
|
@@ -40,10 +40,17 @@ import '../../styled/sheet/StyledSheetFooter.js';
|
|
|
40
40
|
import '../../styled/sheet/StyledSheetFooterItem.js';
|
|
41
41
|
import '../../styled/sheet/StyledSheetHeader.js';
|
|
42
42
|
|
|
43
|
-
const HeaderItemText = React__default.forwardRef((
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
const HeaderItemText = React__default.forwardRef((_ref, ref) => {
|
|
44
|
+
let {
|
|
45
|
+
isClipped,
|
|
46
|
+
...other
|
|
47
|
+
} = _ref;
|
|
48
|
+
return React__default.createElement(StyledHeaderItemText, Object.assign({
|
|
49
|
+
ref: ref,
|
|
50
|
+
$isClipped: isClipped
|
|
51
|
+
}, other));
|
|
52
|
+
});
|
|
53
|
+
HeaderItemText.displayName = 'Header.ItemText';
|
|
47
54
|
HeaderItemText.propTypes = {
|
|
48
55
|
isClipped: PropTypes.bool
|
|
49
56
|
};
|
|
@@ -42,6 +42,6 @@ import '../../styled/sheet/StyledSheetHeader.js';
|
|
|
42
42
|
const HeaderItemWrapper = React__default.forwardRef((props, ref) => React__default.createElement(StyledHeaderItemWrapper, Object.assign({
|
|
43
43
|
ref: ref
|
|
44
44
|
}, props)));
|
|
45
|
-
HeaderItemWrapper.displayName = '
|
|
45
|
+
HeaderItemWrapper.displayName = 'Header.ItemWrapper';
|
|
46
46
|
|
|
47
47
|
export { HeaderItemWrapper };
|
|
@@ -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';
|
|
@@ -46,24 +47,33 @@ import { NavItemIcon } from './NavItemIcon.js';
|
|
|
46
47
|
import { NavItemText } from './NavItemText.js';
|
|
47
48
|
import { NavList } from './NavList.js';
|
|
48
49
|
|
|
49
|
-
const NavComponent = React__default.forwardRef((
|
|
50
|
+
const NavComponent = React__default.forwardRef((_ref, ref) => {
|
|
51
|
+
let {
|
|
52
|
+
isExpanded,
|
|
53
|
+
...other
|
|
54
|
+
} = _ref;
|
|
50
55
|
const {
|
|
51
56
|
hue,
|
|
52
|
-
isLight
|
|
53
|
-
isDark
|
|
57
|
+
isLight
|
|
54
58
|
} = useChromeContext();
|
|
55
59
|
const navContextValue = useMemo(() => ({
|
|
56
|
-
isExpanded: !!
|
|
57
|
-
}), [
|
|
58
|
-
return React__default.createElement(
|
|
60
|
+
isExpanded: !!isExpanded
|
|
61
|
+
}), [isExpanded]);
|
|
62
|
+
return React__default.createElement(ThemeProvider, {
|
|
63
|
+
theme: parentTheme => ({
|
|
64
|
+
...parentTheme,
|
|
65
|
+
colors: {
|
|
66
|
+
...parentTheme.colors,
|
|
67
|
+
base: isLight ? 'light' : 'dark'
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
}, React__default.createElement(NavContext.Provider, {
|
|
59
71
|
value: navContextValue
|
|
60
72
|
}, React__default.createElement(StyledNav, Object.assign({
|
|
61
|
-
ref: ref
|
|
62
|
-
|
|
63
|
-
hue: hue
|
|
64
|
-
|
|
65
|
-
isDark: isDark
|
|
66
|
-
})));
|
|
73
|
+
ref: ref,
|
|
74
|
+
$isExpanded: isExpanded,
|
|
75
|
+
$hue: hue
|
|
76
|
+
}, other))));
|
|
67
77
|
});
|
|
68
78
|
NavComponent.displayName = 'Nav';
|
|
69
79
|
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({
|
|
@@ -79,11 +75,9 @@ const NavItem = React__default.forwardRef((_ref, ref) => {
|
|
|
79
75
|
retVal = React__default.createElement(StyledNavButton, Object.assign({
|
|
80
76
|
tabIndex: 0,
|
|
81
77
|
ref: ref,
|
|
82
|
-
isExpanded: isExpanded,
|
|
83
|
-
hue: hue,
|
|
84
|
-
|
|
85
|
-
isLight: isLight,
|
|
86
|
-
"aria-current": ariaCurrent
|
|
78
|
+
$isExpanded: isExpanded,
|
|
79
|
+
$hue: hue,
|
|
80
|
+
"aria-current": isCurrent || undefined
|
|
87
81
|
}, other));
|
|
88
82
|
}
|
|
89
83
|
if (hasList) {
|
|
@@ -91,7 +85,7 @@ const NavItem = React__default.forwardRef((_ref, ref) => {
|
|
|
91
85
|
}
|
|
92
86
|
return retVal;
|
|
93
87
|
});
|
|
94
|
-
NavItem.displayName = '
|
|
88
|
+
NavItem.displayName = 'Nav.Item';
|
|
95
89
|
NavItem.propTypes = {
|
|
96
90
|
product: PropTypes.oneOf(PRODUCTS),
|
|
97
91
|
hasLogo: PropTypes.bool,
|
|
@@ -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,8 @@ 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
|
};
|
|
49
|
+
NavItemIcon.displayName = 'Nav.ItemIcon';
|
|
65
50
|
|
|
66
51
|
export { NavItemIcon };
|
|
@@ -41,16 +41,21 @@ import '../../styled/sheet/StyledSheetFooterItem.js';
|
|
|
41
41
|
import '../../styled/sheet/StyledSheetHeader.js';
|
|
42
42
|
import { useNavContext } from '../../utils/useNavContext.js';
|
|
43
43
|
|
|
44
|
-
const NavItemText = React__default.forwardRef((
|
|
44
|
+
const NavItemText = React__default.forwardRef((_ref, ref) => {
|
|
45
|
+
let {
|
|
46
|
+
isWrapped,
|
|
47
|
+
...other
|
|
48
|
+
} = _ref;
|
|
45
49
|
const {
|
|
46
50
|
isExpanded
|
|
47
51
|
} = useNavContext();
|
|
48
52
|
return React__default.createElement(StyledNavItemText, Object.assign({
|
|
49
53
|
ref: ref,
|
|
50
|
-
isExpanded: isExpanded
|
|
51
|
-
|
|
54
|
+
$isExpanded: isExpanded,
|
|
55
|
+
$isWrapped: isWrapped
|
|
56
|
+
}, other));
|
|
52
57
|
});
|
|
53
|
-
NavItemText.displayName = '
|
|
58
|
+
NavItemText.displayName = 'Nav.ItemText';
|
|
54
59
|
NavItemText.propTypes = {
|
|
55
60
|
isWrapped: PropTypes.bool
|
|
56
61
|
};
|
|
@@ -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.
|
|
70
|
+
const idPrefix = useMemo(() => id || seed(`sheet_${'9.1.0'}`), [id, seed]);
|
|
71
71
|
const titleId = `${idPrefix}--title`;
|
|
72
72
|
const descriptionId = `${idPrefix}--description`;
|
|
73
73
|
const sheetContext = useMemo(() => ({
|
|
@@ -85,20 +85,21 @@ const SheetComponent = React__default.forwardRef((_ref, ref) => {
|
|
|
85
85
|
return React__default.createElement(SheetContext.Provider, {
|
|
86
86
|
value: sheetContext
|
|
87
87
|
}, React__default.createElement(StyledSheet, Object.assign({
|
|
88
|
-
isOpen:
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
inert: isOpen ? undefined : '',
|
|
89
|
+
$isOpen: isOpen,
|
|
90
|
+
$isAnimated: isAnimated,
|
|
91
|
+
$placement: placement,
|
|
92
|
+
$size: size,
|
|
92
93
|
tabIndex: -1,
|
|
93
94
|
id: idPrefix,
|
|
94
95
|
"aria-labelledby": titleId,
|
|
95
96
|
"aria-describedby": descriptionId,
|
|
96
97
|
ref: mergeRefs([sheetRef, ref])
|
|
97
98
|
}, props), React__default.createElement(StyledSheetWrapper, {
|
|
98
|
-
isOpen: isOpen,
|
|
99
|
-
isAnimated: isAnimated,
|
|
100
|
-
placement: placement,
|
|
101
|
-
size: size
|
|
99
|
+
$isOpen: isOpen,
|
|
100
|
+
$isAnimated: isAnimated,
|
|
101
|
+
$placement: placement,
|
|
102
|
+
$size: size
|
|
102
103
|
}, children)));
|
|
103
104
|
});
|
|
104
105
|
SheetComponent.displayName = 'Sheet';
|
|
@@ -39,10 +39,15 @@ import { StyledSheetFooter } from '../../../styled/sheet/StyledSheetFooter.js';
|
|
|
39
39
|
import '../../../styled/sheet/StyledSheetFooterItem.js';
|
|
40
40
|
import '../../../styled/sheet/StyledSheetHeader.js';
|
|
41
41
|
|
|
42
|
-
const SheetFooter = forwardRef((
|
|
42
|
+
const SheetFooter = forwardRef((_ref, ref) => {
|
|
43
|
+
let {
|
|
44
|
+
isCompact,
|
|
45
|
+
...other
|
|
46
|
+
} = _ref;
|
|
43
47
|
return React__default.createElement(StyledSheetFooter, Object.assign({
|
|
44
|
-
ref: ref
|
|
45
|
-
|
|
48
|
+
ref: ref,
|
|
49
|
+
$isCompact: isCompact
|
|
50
|
+
}, other));
|
|
46
51
|
});
|
|
47
52
|
SheetFooter.displayName = 'Sheet.Footer';
|
|
48
53
|
const Footer = SheetFooter;
|
|
@@ -46,7 +46,7 @@ const SheetHeader = forwardRef((props, ref) => {
|
|
|
46
46
|
} = useSheetContext();
|
|
47
47
|
return React__default.createElement(StyledSheetHeader, Object.assign({
|
|
48
48
|
ref: ref,
|
|
49
|
-
isCloseButtonPresent: isCloseButtonPresent
|
|
49
|
+
$isCloseButtonPresent: isCloseButtonPresent
|
|
50
50
|
}, props));
|
|
51
51
|
});
|
|
52
52
|
SheetHeader.displayName = 'Sheet.Header';
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
|
|
9
9
|
var _path;
|
|
10
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
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
11
|
var SvgLinkStroke = function SvgLinkStroke(props) {
|
|
12
12
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
13
13
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
|
|
9
9
|
var _path;
|
|
10
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
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
11
|
var SvgXStroke = function SvgXStroke(props) {
|
|
12
12
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
13
13
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -5,18 +5,15 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import styled from 'styled-components';
|
|
8
|
-
import { retrieveComponentStyles
|
|
8
|
+
import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
|
|
9
9
|
|
|
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.
|
|
13
|
+
'data-garden-version': '9.1.0'
|
|
14
14
|
}).withConfig({
|
|
15
15
|
displayName: "StyledChrome",
|
|
16
16
|
componentId: "sc-1uqm6u6-0"
|
|
17
17
|
})(["display:flex;position:relative;margin:0;height:100vh;overflow-y:hidden;font-family:", ";direction:", ";", ";"], props => props.theme.fonts.system, props => props.theme.rtl && 'rtl', props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
18
|
-
StyledChrome.defaultProps = {
|
|
19
|
-
theme: DEFAULT_THEME
|
|
20
|
-
};
|
|
21
18
|
|
|
22
19
|
export { StyledChrome };
|
|
@@ -6,41 +6,59 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import styled, { keyframes, css } from 'styled-components';
|
|
8
8
|
import { math } from 'polished';
|
|
9
|
-
import { SELECTOR_FOCUS_VISIBLE, retrieveComponentStyles,
|
|
10
|
-
import { getHeaderHeight } from './
|
|
9
|
+
import { SELECTOR_FOCUS_VISIBLE, retrieveComponentStyles, 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
|
+
variable: 'shadow.medium',
|
|
31
|
+
theme
|
|
32
|
+
});
|
|
33
|
+
const boxShadow = theme.shadows.lg(`${theme.space.base * 4}px`, `${theme.space.base * 6}px`, boxShadowColor);
|
|
34
|
+
const foregroundColor = getColor({
|
|
35
|
+
theme,
|
|
36
|
+
variable: 'foreground.primary'
|
|
37
|
+
});
|
|
38
|
+
return css(["border-color:", ";box-shadow:", ";background-color:", ";color:", ";&:hover,&:focus{color:", ";}", ""], borderColor, boxShadow, backgroundColor, foregroundColor, foregroundColor, focusStyles({
|
|
22
39
|
theme,
|
|
23
40
|
inset: true,
|
|
24
41
|
boxShadow
|
|
25
42
|
}));
|
|
26
43
|
};
|
|
27
|
-
const sizeStyles =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const
|
|
44
|
+
const sizeStyles = _ref2 => {
|
|
45
|
+
let {
|
|
46
|
+
theme
|
|
47
|
+
} = _ref2;
|
|
48
|
+
const top = math(`${getHeaderHeight(theme)} / 2`);
|
|
49
|
+
const border = theme.borders.sm;
|
|
50
|
+
const padding = `${theme.space.base * 5}px`;
|
|
51
|
+
const paddingStart = `${theme.space.base * 4}px`;
|
|
52
|
+
const fontSize = theme.fontSizes.md;
|
|
32
53
|
const lineHeight = getLineHeight(padding, fontSize);
|
|
33
|
-
return css(["top:", ";padding:", ";padding-", ":", ";line-height:", ";font-size:", ";"], top, padding,
|
|
54
|
+
return css(["top:", ";border:", ";padding:", ";padding-", ":", ";line-height:", ";font-size:", ";"], top, border, padding, theme.rtl ? 'right' : 'left', paddingStart, lineHeight, fontSize);
|
|
34
55
|
};
|
|
35
56
|
const StyledSkipNav = styled.a.attrs({
|
|
36
57
|
'data-garden-id': COMPONENT_ID,
|
|
37
|
-
'data-garden-version': '9.
|
|
58
|
+
'data-garden-version': '9.1.0'
|
|
38
59
|
}).withConfig({
|
|
39
60
|
displayName: "StyledSkipNav",
|
|
40
61
|
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
|
|
42
|
-
StyledSkipNav.defaultProps = {
|
|
43
|
-
theme: DEFAULT_THEME
|
|
44
|
-
};
|
|
62
|
+
})(["", ";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));
|
|
45
63
|
|
|
46
64
|
export { StyledSkipNav };
|
|
@@ -6,23 +6,26 @@
|
|
|
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 } 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.
|
|
22
|
+
'data-garden-version': '9.1.0'
|
|
20
23
|
}).withConfig({
|
|
21
24
|
displayName: "StyledSkipNavIcon",
|
|
22
25
|
componentId: "sc-1ika5z4-0"
|
|
23
|
-
})(["transform:", ";color:", ";", ";", ";"],
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
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));
|
|
27
30
|
|
|
28
31
|
export { StyledSkipNavIcon };
|
|
@@ -5,18 +5,18 @@
|
|
|
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 } 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.
|
|
13
|
+
'data-garden-version': '9.1.0'
|
|
14
14
|
}).withConfig({
|
|
15
15
|
displayName: "StyledBody",
|
|
16
16
|
componentId: "sc-c7h9kv-0"
|
|
17
|
-
})(["flex:1;order:1;background-color:", ";min-width:0;", ";"], props =>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
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));
|
|
21
21
|
|
|
22
22
|
export { StyledBody };
|