@zendeskgarden/react-tabs 9.0.0-next.12 → 9.0.0-next.14
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/Tab.js +4 -2
- package/dist/esm/elements/TabList.js +3 -1
- package/dist/esm/elements/TabPanel.js +2 -1
- package/dist/esm/elements/Tabs.js +5 -1
- package/dist/esm/styled/StyledTab.js +27 -9
- package/dist/esm/styled/StyledTabList.js +23 -4
- package/dist/esm/styled/StyledTabPanel.js +11 -3
- package/dist/esm/styled/StyledTabs.js +3 -12
- package/dist/index.cjs.js +76 -28
- package/dist/typings/styled/StyledTab.d.ts +5 -6
- package/dist/typings/styled/StyledTabList.d.ts +7 -5
- package/dist/typings/styled/StyledTabPanel.d.ts +7 -5
- package/dist/typings/styled/StyledTabs.d.ts +1 -5
- package/dist/typings/utils/useTabsContext.d.ts +6 -2
- package/package.json +5 -5
package/dist/esm/elements/Tab.js
CHANGED
|
@@ -24,7 +24,8 @@ const Tab = React.forwardRef((_ref, ref) => {
|
|
|
24
24
|
return React.createElement(StyledTab, Object.assign({
|
|
25
25
|
role: "tab",
|
|
26
26
|
"aria-disabled": disabled,
|
|
27
|
-
ref: ref
|
|
27
|
+
ref: ref,
|
|
28
|
+
isVertical: tabsPropGetters?.isVertical
|
|
28
29
|
}, otherProps));
|
|
29
30
|
}
|
|
30
31
|
const {
|
|
@@ -34,7 +35,8 @@ const Tab = React.forwardRef((_ref, ref) => {
|
|
|
34
35
|
value: item
|
|
35
36
|
});
|
|
36
37
|
return React.createElement(StyledTab, Object.assign({
|
|
37
|
-
isSelected: item === tabsPropGetters.selectedValue
|
|
38
|
+
isSelected: item === tabsPropGetters.selectedValue,
|
|
39
|
+
isVertical: tabsPropGetters.isVertical
|
|
38
40
|
}, tabProps, otherProps, {
|
|
39
41
|
ref: mergeRefs([tabRef, ref])
|
|
40
42
|
}));
|
|
@@ -19,7 +19,9 @@ const TabList = React.forwardRef((props, ref) => {
|
|
|
19
19
|
}, props));
|
|
20
20
|
}
|
|
21
21
|
const tabListProps = tabsPropGetters.getTabListProps();
|
|
22
|
-
return React.createElement(StyledTabList, Object.assign({
|
|
22
|
+
return React.createElement(StyledTabList, Object.assign({
|
|
23
|
+
isVertical: tabsPropGetters.isVertical
|
|
24
|
+
}, tabListProps, props, {
|
|
23
25
|
ref: ref
|
|
24
26
|
}));
|
|
25
27
|
});
|
|
@@ -27,7 +27,8 @@ const TabPanel = React.forwardRef((_ref, ref) => {
|
|
|
27
27
|
value: item
|
|
28
28
|
});
|
|
29
29
|
return React.createElement(StyledTabPanel, Object.assign({
|
|
30
|
-
"aria-hidden": tabsPropGetters.selectedValue !== item
|
|
30
|
+
"aria-hidden": tabsPropGetters.selectedValue !== item,
|
|
31
|
+
isVertical: tabsPropGetters.isVertical
|
|
31
32
|
}, tabPanelProps, otherProps, {
|
|
32
33
|
ref: ref
|
|
33
34
|
}));
|
|
@@ -43,8 +43,12 @@ const TabsComponent = forwardRef((_ref, ref) => {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
|
+
const contextValue = useMemo(() => ({
|
|
47
|
+
isVertical,
|
|
48
|
+
...tabsContextValue
|
|
49
|
+
}), [isVertical, tabsContextValue]);
|
|
46
50
|
return React.createElement(TabsContext.Provider, {
|
|
47
|
-
value:
|
|
51
|
+
value: contextValue
|
|
48
52
|
}, React.createElement(StyledTabs, Object.assign({
|
|
49
53
|
isVertical: isVertical
|
|
50
54
|
}, otherProps, {
|
|
@@ -12,10 +12,12 @@ const COMPONENT_ID = 'tabs.tab';
|
|
|
12
12
|
const colorStyles = _ref => {
|
|
13
13
|
let {
|
|
14
14
|
theme,
|
|
15
|
-
isSelected
|
|
15
|
+
isSelected,
|
|
16
|
+
isVertical
|
|
16
17
|
} = _ref;
|
|
18
|
+
const borderColor = isSelected ? 'currentcolor' : 'transparent';
|
|
17
19
|
const selectedColor = getColorV8('primaryHue', 600, theme);
|
|
18
|
-
return css(["border-color:", ";color:", ";&:hover{color:", ";}", " &:active{border-color:currentcolor;color:", ";}&[aria-disabled='true']{border-color:transparent;color:", ";}"],
|
|
20
|
+
return css(["border-bottom-color:", ";border-", "-color:", ";color:", ";&:hover{color:", ";}", " &:active{border-color:currentcolor;color:", ";}&[aria-disabled='true']{border-color:transparent;color:", ";}"], isVertical ? undefined : borderColor, theme.rtl ? 'right' : 'left', isVertical ? borderColor : undefined, isSelected ? selectedColor : 'inherit', selectedColor, focusStyles({
|
|
19
21
|
theme,
|
|
20
22
|
inset: true,
|
|
21
23
|
spacerWidth: null,
|
|
@@ -28,20 +30,36 @@ const colorStyles = _ref => {
|
|
|
28
30
|
};
|
|
29
31
|
const sizeStyles = _ref2 => {
|
|
30
32
|
let {
|
|
31
|
-
theme
|
|
33
|
+
theme,
|
|
34
|
+
isVertical
|
|
32
35
|
} = _ref2;
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
const borderWidth = theme.borderWidths.md;
|
|
37
|
+
const focusHeight = `${theme.space.base * 5}px`;
|
|
38
|
+
let marginBottom;
|
|
39
|
+
let padding;
|
|
40
|
+
if (isVertical) {
|
|
41
|
+
marginBottom = `${theme.space.base * 5}px`;
|
|
42
|
+
padding = `${theme.space.base}px ${theme.space.base * 2}px`;
|
|
43
|
+
} else {
|
|
44
|
+
const paddingTop = theme.space.base * 2.5;
|
|
45
|
+
const paddingHorizontal = theme.space.base * 7;
|
|
46
|
+
const paddingBottom = paddingTop - stripUnit(theme.borderWidths.md) - stripUnit(theme.borderWidths.sm);
|
|
47
|
+
padding = `${paddingTop}px ${paddingHorizontal}px ${paddingBottom}px`;
|
|
48
|
+
}
|
|
49
|
+
return css(["margin-bottom:", ";border-width:", ";padding:", ";&:focus-visible::before,&[data-garden-focus-visible]::before{height:", ";}&:last-of-type{margin-bottom:0;}"], marginBottom, borderWidth, padding, focusHeight);
|
|
37
50
|
};
|
|
38
51
|
const StyledTab = styled.div.attrs({
|
|
39
52
|
'data-garden-id': COMPONENT_ID,
|
|
40
|
-
'data-garden-version': '9.0.0-next.
|
|
53
|
+
'data-garden-version': '9.0.0-next.14'
|
|
41
54
|
}).withConfig({
|
|
42
55
|
displayName: "StyledTab",
|
|
43
56
|
componentId: "sc-x2pbow-0"
|
|
44
|
-
})(["display:
|
|
57
|
+
})(["display:", ";position:relative;transition:color 0.25s ease-in-out;border-bottom:", ";border-", ":", ";cursor:pointer;overflow:hidden;vertical-align:top;user-select:none;text-align:", ";text-decoration:none;text-overflow:ellipsis;", ";", ";&:focus{text-decoration:none;}&::before{transition:box-shadow 0.1s ease-in-out;content:'';}&:focus-visible::before{position:absolute;top:", "px;right:", "px;left:", "px;border-radius:", ";pointer-events:none;}&:active::before{box-shadow:none;}&[aria-disabled='true']{cursor:default;}", ";"], props => props.isVertical ? 'block' : 'inline-block', props => props.isVertical ? undefined : props.theme.borderStyles.solid, props => props.theme.rtl ? 'right' : 'left', props => props.isVertical ? props.theme.borderStyles.solid : undefined, props => {
|
|
58
|
+
if (props.isVertical) {
|
|
59
|
+
return props.theme.rtl ? 'right' : 'left';
|
|
60
|
+
}
|
|
61
|
+
return 'center';
|
|
62
|
+
}, sizeStyles, colorStyles, props => props.theme.space.base * (props.isVertical ? 1 : 2.5), props => props.theme.space.base * (props.isVertical ? 1 : 6), props => props.theme.space.base * (props.isVertical ? 1 : 6), props => props.theme.borderRadii.md, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
45
63
|
StyledTab.defaultProps = {
|
|
46
64
|
theme: DEFAULT_THEME
|
|
47
65
|
};
|
|
@@ -4,17 +4,36 @@
|
|
|
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, getColorV8, getLineHeight } from '@zendeskgarden/react-theming';
|
|
9
9
|
|
|
10
10
|
const COMPONENT_ID = 'tabs.tablist';
|
|
11
|
+
const colorStyles = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
theme
|
|
14
|
+
} = _ref;
|
|
15
|
+
const borderColor = getColorV8('neutralHue', 300, theme);
|
|
16
|
+
const foregroundColor = getColorV8('neutralHue', 600, theme);
|
|
17
|
+
return css(["border-bottom-color:", ";color:", ";"], borderColor, foregroundColor);
|
|
18
|
+
};
|
|
19
|
+
const sizeStyles = _ref2 => {
|
|
20
|
+
let {
|
|
21
|
+
theme,
|
|
22
|
+
isVertical
|
|
23
|
+
} = _ref2;
|
|
24
|
+
const marginBottom = isVertical ? 0 : `${theme.space.base * 5}px`;
|
|
25
|
+
const borderBottom = isVertical ? undefined : theme.borderWidths.sm;
|
|
26
|
+
const fontSize = theme.fontSizes.md;
|
|
27
|
+
const lineHeight = getLineHeight(theme.space.base * 5, fontSize);
|
|
28
|
+
return css(["margin-top:0;margin-bottom:", ";border-bottom-width:", ";padding:0;line-height:", ";font-size:", ";"], marginBottom, borderBottom, lineHeight, fontSize);
|
|
29
|
+
};
|
|
11
30
|
const StyledTabList = styled.div.attrs({
|
|
12
31
|
'data-garden-id': COMPONENT_ID,
|
|
13
|
-
'data-garden-version': '9.0.0-next.
|
|
32
|
+
'data-garden-version': '9.0.0-next.14'
|
|
14
33
|
}).withConfig({
|
|
15
34
|
displayName: "StyledTabList",
|
|
16
35
|
componentId: "sc-wa5aaj-0"
|
|
17
|
-
})(["display:
|
|
36
|
+
})(["display:", ";border-bottom:", ";vertical-align:", ";white-space:nowrap;", ";", ";", ";"], props => props.isVertical ? 'table-cell' : 'block', props => props.isVertical ? 'none' : props.theme.borderStyles.solid, props => props.isVertical ? 'top' : undefined, sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
18
37
|
StyledTabList.defaultProps = {
|
|
19
38
|
theme: DEFAULT_THEME
|
|
20
39
|
};
|
|
@@ -4,17 +4,25 @@
|
|
|
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 { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
9
|
|
|
10
10
|
const COMPONENT_ID = 'tabs.tabpanel';
|
|
11
|
+
const sizeStyles = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
theme,
|
|
14
|
+
isVertical
|
|
15
|
+
} = _ref;
|
|
16
|
+
const margin = isVertical ? `${theme.space.base * 8}px` : undefined;
|
|
17
|
+
return css(["margin-", ":", ";"], theme.rtl ? 'right' : 'left', margin);
|
|
18
|
+
};
|
|
11
19
|
const StyledTabPanel = styled.div.attrs({
|
|
12
20
|
'data-garden-id': COMPONENT_ID,
|
|
13
|
-
'data-garden-version': '9.0.0-next.
|
|
21
|
+
'data-garden-version': '9.0.0-next.14'
|
|
14
22
|
}).withConfig({
|
|
15
23
|
displayName: "StyledTabPanel",
|
|
16
24
|
componentId: "sc-7lhrmp-0"
|
|
17
|
-
})(["display:block;&[aria-hidden='true']{display:none;}", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
25
|
+
})(["display:block;vertical-align:", ";", ";&[aria-hidden='true']{display:none;}", ";"], props => props.isVertical && 'top', sizeStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
18
26
|
StyledTabPanel.defaultProps = {
|
|
19
27
|
theme: DEFAULT_THEME
|
|
20
28
|
};
|
|
@@ -4,26 +4,17 @@
|
|
|
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
|
|
7
|
+
import styled from 'styled-components';
|
|
8
8
|
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
-
import { StyledTab } from './StyledTab.js';
|
|
10
|
-
import { StyledTabPanel } from './StyledTabPanel.js';
|
|
11
|
-
import { StyledTabList } from './StyledTabList.js';
|
|
12
9
|
|
|
13
10
|
const COMPONENT_ID = 'tabs.tabs';
|
|
14
|
-
const verticalStyling = _ref => {
|
|
15
|
-
let {
|
|
16
|
-
theme
|
|
17
|
-
} = _ref;
|
|
18
|
-
return css(["display:table;", "{display:table-cell;margin-bottom:0;border-bottom:none;vertical-align:top;}", "{display:block;margin-bottom:", "px;margin-left:", ";border-left:", ";border-bottom-style:none;border-", "-style:", ";border-", "-color:transparent;padding:", "px ", "px;text-align:", ";&:last-of-type{margin-bottom:0;}&:focus-visible::before{top:", "px;right:", "px;left:", "px;}}", "{margin-", ":", "px;vertical-align:top;}"], StyledTabList, StyledTab, theme.space.base * 5, theme.rtl && '0', theme.rtl && '0', theme.rtl ? 'right' : 'left', theme.borderStyles.solid, theme.rtl ? 'right' : 'left', theme.space.base, theme.space.base * 2, theme.rtl ? 'right' : 'left', theme.space.base, theme.space.base, theme.space.base, StyledTabPanel, theme.rtl ? 'right' : 'left', theme.space.base * 8);
|
|
19
|
-
};
|
|
20
11
|
const StyledTabs = styled.div.attrs({
|
|
21
12
|
'data-garden-id': COMPONENT_ID,
|
|
22
|
-
'data-garden-version': '9.0.0-next.
|
|
13
|
+
'data-garden-version': '9.0.0-next.14'
|
|
23
14
|
}).withConfig({
|
|
24
15
|
displayName: "StyledTabs",
|
|
25
16
|
componentId: "sc-1qaor65-0"
|
|
26
|
-
})(["display:
|
|
17
|
+
})(["display:", ";overflow:hidden;direction:", ";", ";"], props => props.isVertical ? 'table' : 'block', props => props.theme.rtl && 'rtl', props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
27
18
|
StyledTabs.defaultProps = {
|
|
28
19
|
theme: DEFAULT_THEME
|
|
29
20
|
};
|
package/dist/index.cjs.js
CHANGED
|
@@ -22,13 +22,15 @@ var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
|
|
|
22
22
|
var styled__default = /*#__PURE__*/_interopDefault(styled);
|
|
23
23
|
|
|
24
24
|
const COMPONENT_ID$3 = 'tabs.tab';
|
|
25
|
-
const colorStyles = _ref => {
|
|
25
|
+
const colorStyles$1 = _ref => {
|
|
26
26
|
let {
|
|
27
27
|
theme,
|
|
28
|
-
isSelected
|
|
28
|
+
isSelected,
|
|
29
|
+
isVertical
|
|
29
30
|
} = _ref;
|
|
31
|
+
const borderColor = isSelected ? 'currentcolor' : 'transparent';
|
|
30
32
|
const selectedColor = reactTheming.getColorV8('primaryHue', 600, theme);
|
|
31
|
-
return styled.css(["border-color:", ";color:", ";&:hover{color:", ";}", " &:active{border-color:currentcolor;color:", ";}&[aria-disabled='true']{border-color:transparent;color:", ";}"],
|
|
33
|
+
return styled.css(["border-bottom-color:", ";border-", "-color:", ";color:", ";&:hover{color:", ";}", " &:active{border-color:currentcolor;color:", ";}&[aria-disabled='true']{border-color:transparent;color:", ";}"], isVertical ? undefined : borderColor, theme.rtl ? 'right' : 'left', isVertical ? borderColor : undefined, isSelected ? selectedColor : 'inherit', selectedColor, reactTheming.focusStyles({
|
|
32
34
|
theme,
|
|
33
35
|
inset: true,
|
|
34
36
|
spacerWidth: null,
|
|
@@ -39,64 +41,101 @@ const colorStyles = _ref => {
|
|
|
39
41
|
}
|
|
40
42
|
}), selectedColor, props => reactTheming.getColorV8('neutralHue', 400, props.theme));
|
|
41
43
|
};
|
|
42
|
-
const sizeStyles = _ref2 => {
|
|
44
|
+
const sizeStyles$2 = _ref2 => {
|
|
43
45
|
let {
|
|
44
|
-
theme
|
|
46
|
+
theme,
|
|
47
|
+
isVertical
|
|
45
48
|
} = _ref2;
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
const borderWidth = theme.borderWidths.md;
|
|
50
|
+
const focusHeight = `${theme.space.base * 5}px`;
|
|
51
|
+
let marginBottom;
|
|
52
|
+
let padding;
|
|
53
|
+
if (isVertical) {
|
|
54
|
+
marginBottom = `${theme.space.base * 5}px`;
|
|
55
|
+
padding = `${theme.space.base}px ${theme.space.base * 2}px`;
|
|
56
|
+
} else {
|
|
57
|
+
const paddingTop = theme.space.base * 2.5;
|
|
58
|
+
const paddingHorizontal = theme.space.base * 7;
|
|
59
|
+
const paddingBottom = paddingTop - polished.stripUnit(theme.borderWidths.md) - polished.stripUnit(theme.borderWidths.sm);
|
|
60
|
+
padding = `${paddingTop}px ${paddingHorizontal}px ${paddingBottom}px`;
|
|
61
|
+
}
|
|
62
|
+
return styled.css(["margin-bottom:", ";border-width:", ";padding:", ";&:focus-visible::before,&[data-garden-focus-visible]::before{height:", ";}&:last-of-type{margin-bottom:0;}"], marginBottom, borderWidth, padding, focusHeight);
|
|
50
63
|
};
|
|
51
64
|
const StyledTab = styled__default.default.div.attrs({
|
|
52
65
|
'data-garden-id': COMPONENT_ID$3,
|
|
53
|
-
'data-garden-version': '9.0.0-next.
|
|
66
|
+
'data-garden-version': '9.0.0-next.14'
|
|
54
67
|
}).withConfig({
|
|
55
68
|
displayName: "StyledTab",
|
|
56
69
|
componentId: "sc-x2pbow-0"
|
|
57
|
-
})(["display:
|
|
70
|
+
})(["display:", ";position:relative;transition:color 0.25s ease-in-out;border-bottom:", ";border-", ":", ";cursor:pointer;overflow:hidden;vertical-align:top;user-select:none;text-align:", ";text-decoration:none;text-overflow:ellipsis;", ";", ";&:focus{text-decoration:none;}&::before{transition:box-shadow 0.1s ease-in-out;content:'';}&:focus-visible::before{position:absolute;top:", "px;right:", "px;left:", "px;border-radius:", ";pointer-events:none;}&:active::before{box-shadow:none;}&[aria-disabled='true']{cursor:default;}", ";"], props => props.isVertical ? 'block' : 'inline-block', props => props.isVertical ? undefined : props.theme.borderStyles.solid, props => props.theme.rtl ? 'right' : 'left', props => props.isVertical ? props.theme.borderStyles.solid : undefined, props => {
|
|
71
|
+
if (props.isVertical) {
|
|
72
|
+
return props.theme.rtl ? 'right' : 'left';
|
|
73
|
+
}
|
|
74
|
+
return 'center';
|
|
75
|
+
}, sizeStyles$2, colorStyles$1, props => props.theme.space.base * (props.isVertical ? 1 : 2.5), props => props.theme.space.base * (props.isVertical ? 1 : 6), props => props.theme.space.base * (props.isVertical ? 1 : 6), props => props.theme.borderRadii.md, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props));
|
|
58
76
|
StyledTab.defaultProps = {
|
|
59
77
|
theme: reactTheming.DEFAULT_THEME
|
|
60
78
|
};
|
|
61
79
|
|
|
62
80
|
const COMPONENT_ID$2 = 'tabs.tablist';
|
|
81
|
+
const colorStyles = _ref => {
|
|
82
|
+
let {
|
|
83
|
+
theme
|
|
84
|
+
} = _ref;
|
|
85
|
+
const borderColor = reactTheming.getColorV8('neutralHue', 300, theme);
|
|
86
|
+
const foregroundColor = reactTheming.getColorV8('neutralHue', 600, theme);
|
|
87
|
+
return styled.css(["border-bottom-color:", ";color:", ";"], borderColor, foregroundColor);
|
|
88
|
+
};
|
|
89
|
+
const sizeStyles$1 = _ref2 => {
|
|
90
|
+
let {
|
|
91
|
+
theme,
|
|
92
|
+
isVertical
|
|
93
|
+
} = _ref2;
|
|
94
|
+
const marginBottom = isVertical ? 0 : `${theme.space.base * 5}px`;
|
|
95
|
+
const borderBottom = isVertical ? undefined : theme.borderWidths.sm;
|
|
96
|
+
const fontSize = theme.fontSizes.md;
|
|
97
|
+
const lineHeight = reactTheming.getLineHeight(theme.space.base * 5, fontSize);
|
|
98
|
+
return styled.css(["margin-top:0;margin-bottom:", ";border-bottom-width:", ";padding:0;line-height:", ";font-size:", ";"], marginBottom, borderBottom, lineHeight, fontSize);
|
|
99
|
+
};
|
|
63
100
|
const StyledTabList = styled__default.default.div.attrs({
|
|
64
101
|
'data-garden-id': COMPONENT_ID$2,
|
|
65
|
-
'data-garden-version': '9.0.0-next.
|
|
102
|
+
'data-garden-version': '9.0.0-next.14'
|
|
66
103
|
}).withConfig({
|
|
67
104
|
displayName: "StyledTabList",
|
|
68
105
|
componentId: "sc-wa5aaj-0"
|
|
69
|
-
})(["display:
|
|
106
|
+
})(["display:", ";border-bottom:", ";vertical-align:", ";white-space:nowrap;", ";", ";", ";"], props => props.isVertical ? 'table-cell' : 'block', props => props.isVertical ? 'none' : props.theme.borderStyles.solid, props => props.isVertical ? 'top' : undefined, sizeStyles$1, colorStyles, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props));
|
|
70
107
|
StyledTabList.defaultProps = {
|
|
71
108
|
theme: reactTheming.DEFAULT_THEME
|
|
72
109
|
};
|
|
73
110
|
|
|
74
111
|
const COMPONENT_ID$1 = 'tabs.tabpanel';
|
|
112
|
+
const sizeStyles = _ref => {
|
|
113
|
+
let {
|
|
114
|
+
theme,
|
|
115
|
+
isVertical
|
|
116
|
+
} = _ref;
|
|
117
|
+
const margin = isVertical ? `${theme.space.base * 8}px` : undefined;
|
|
118
|
+
return styled.css(["margin-", ":", ";"], theme.rtl ? 'right' : 'left', margin);
|
|
119
|
+
};
|
|
75
120
|
const StyledTabPanel = styled__default.default.div.attrs({
|
|
76
121
|
'data-garden-id': COMPONENT_ID$1,
|
|
77
|
-
'data-garden-version': '9.0.0-next.
|
|
122
|
+
'data-garden-version': '9.0.0-next.14'
|
|
78
123
|
}).withConfig({
|
|
79
124
|
displayName: "StyledTabPanel",
|
|
80
125
|
componentId: "sc-7lhrmp-0"
|
|
81
|
-
})(["display:block;&[aria-hidden='true']{display:none;}", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props));
|
|
126
|
+
})(["display:block;vertical-align:", ";", ";&[aria-hidden='true']{display:none;}", ";"], props => props.isVertical && 'top', sizeStyles, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props));
|
|
82
127
|
StyledTabPanel.defaultProps = {
|
|
83
128
|
theme: reactTheming.DEFAULT_THEME
|
|
84
129
|
};
|
|
85
130
|
|
|
86
131
|
const COMPONENT_ID = 'tabs.tabs';
|
|
87
|
-
const verticalStyling = _ref => {
|
|
88
|
-
let {
|
|
89
|
-
theme
|
|
90
|
-
} = _ref;
|
|
91
|
-
return styled.css(["display:table;", "{display:table-cell;margin-bottom:0;border-bottom:none;vertical-align:top;}", "{display:block;margin-bottom:", "px;margin-left:", ";border-left:", ";border-bottom-style:none;border-", "-style:", ";border-", "-color:transparent;padding:", "px ", "px;text-align:", ";&:last-of-type{margin-bottom:0;}&:focus-visible::before{top:", "px;right:", "px;left:", "px;}}", "{margin-", ":", "px;vertical-align:top;}"], StyledTabList, StyledTab, theme.space.base * 5, theme.rtl && '0', theme.rtl && '0', theme.rtl ? 'right' : 'left', theme.borderStyles.solid, theme.rtl ? 'right' : 'left', theme.space.base, theme.space.base * 2, theme.rtl ? 'right' : 'left', theme.space.base, theme.space.base, theme.space.base, StyledTabPanel, theme.rtl ? 'right' : 'left', theme.space.base * 8);
|
|
92
|
-
};
|
|
93
132
|
const StyledTabs = styled__default.default.div.attrs({
|
|
94
133
|
'data-garden-id': COMPONENT_ID,
|
|
95
|
-
'data-garden-version': '9.0.0-next.
|
|
134
|
+
'data-garden-version': '9.0.0-next.14'
|
|
96
135
|
}).withConfig({
|
|
97
136
|
displayName: "StyledTabs",
|
|
98
137
|
componentId: "sc-1qaor65-0"
|
|
99
|
-
})(["display:
|
|
138
|
+
})(["display:", ";overflow:hidden;direction:", ";", ";"], props => props.isVertical ? 'table' : 'block', props => props.theme.rtl && 'rtl', props => reactTheming.retrieveComponentStyles(COMPONENT_ID, props));
|
|
100
139
|
StyledTabs.defaultProps = {
|
|
101
140
|
theme: reactTheming.DEFAULT_THEME
|
|
102
141
|
};
|
|
@@ -117,7 +156,8 @@ const Tab = React__default.default.forwardRef((_ref, ref) => {
|
|
|
117
156
|
return React__default.default.createElement(StyledTab, Object.assign({
|
|
118
157
|
role: "tab",
|
|
119
158
|
"aria-disabled": disabled,
|
|
120
|
-
ref: ref
|
|
159
|
+
ref: ref,
|
|
160
|
+
isVertical: tabsPropGetters?.isVertical
|
|
121
161
|
}, otherProps));
|
|
122
162
|
}
|
|
123
163
|
const {
|
|
@@ -127,7 +167,8 @@ const Tab = React__default.default.forwardRef((_ref, ref) => {
|
|
|
127
167
|
value: item
|
|
128
168
|
});
|
|
129
169
|
return React__default.default.createElement(StyledTab, Object.assign({
|
|
130
|
-
isSelected: item === tabsPropGetters.selectedValue
|
|
170
|
+
isSelected: item === tabsPropGetters.selectedValue,
|
|
171
|
+
isVertical: tabsPropGetters.isVertical
|
|
131
172
|
}, tabProps, otherProps, {
|
|
132
173
|
ref: reactMergeRefs.mergeRefs([tabRef, ref])
|
|
133
174
|
}));
|
|
@@ -146,7 +187,9 @@ const TabList = React__default.default.forwardRef((props, ref) => {
|
|
|
146
187
|
}, props));
|
|
147
188
|
}
|
|
148
189
|
const tabListProps = tabsPropGetters.getTabListProps();
|
|
149
|
-
return React__default.default.createElement(StyledTabList, Object.assign({
|
|
190
|
+
return React__default.default.createElement(StyledTabList, Object.assign({
|
|
191
|
+
isVertical: tabsPropGetters.isVertical
|
|
192
|
+
}, tabListProps, props, {
|
|
150
193
|
ref: ref
|
|
151
194
|
}));
|
|
152
195
|
});
|
|
@@ -167,7 +210,8 @@ const TabPanel = React__default.default.forwardRef((_ref, ref) => {
|
|
|
167
210
|
value: item
|
|
168
211
|
});
|
|
169
212
|
return React__default.default.createElement(StyledTabPanel, Object.assign({
|
|
170
|
-
"aria-hidden": tabsPropGetters.selectedValue !== item
|
|
213
|
+
"aria-hidden": tabsPropGetters.selectedValue !== item,
|
|
214
|
+
isVertical: tabsPropGetters.isVertical
|
|
171
215
|
}, tabPanelProps, otherProps, {
|
|
172
216
|
ref: ref
|
|
173
217
|
}));
|
|
@@ -220,8 +264,12 @@ const TabsComponent = React.forwardRef((_ref, ref) => {
|
|
|
220
264
|
}
|
|
221
265
|
}
|
|
222
266
|
});
|
|
267
|
+
const contextValue = React.useMemo(() => ({
|
|
268
|
+
isVertical,
|
|
269
|
+
...tabsContextValue
|
|
270
|
+
}), [isVertical, tabsContextValue]);
|
|
223
271
|
return React__default.default.createElement(TabsContext.Provider, {
|
|
224
|
-
value:
|
|
272
|
+
value: contextValue
|
|
225
273
|
}, React__default.default.createElement(StyledTabs, Object.assign({
|
|
226
274
|
isVertical: isVertical
|
|
227
275
|
}, otherProps, {
|
|
@@ -7,11 +7,10 @@
|
|
|
7
7
|
import { DefaultTheme } from 'styled-components';
|
|
8
8
|
interface IStyledTabProps {
|
|
9
9
|
isSelected?: boolean;
|
|
10
|
+
isVertical?: boolean;
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
*/
|
|
16
|
-
export declare const StyledTab: import("styled-components").StyledComponent<"div", DefaultTheme, IStyledTabProps, never>;
|
|
12
|
+
export declare const StyledTab: import("styled-components").StyledComponent<"div", DefaultTheme, {
|
|
13
|
+
'data-garden-id': string;
|
|
14
|
+
'data-garden-version': string;
|
|
15
|
+
} & IStyledTabProps, "data-garden-id" | "data-garden-version">;
|
|
17
16
|
export {};
|
|
@@ -4,10 +4,12 @@
|
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
import { DefaultTheme } from 'styled-components';
|
|
8
|
+
interface IStyledTabListProps {
|
|
9
|
+
isVertical?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const StyledTabList: import("styled-components").StyledComponent<"div", DefaultTheme, {
|
|
11
12
|
'data-garden-id': string;
|
|
12
13
|
'data-garden-version': string;
|
|
13
|
-
}, "data-garden-id" | "data-garden-version">;
|
|
14
|
+
} & IStyledTabListProps, "data-garden-id" | "data-garden-version">;
|
|
15
|
+
export {};
|
|
@@ -4,10 +4,12 @@
|
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
import { DefaultTheme } from 'styled-components';
|
|
8
|
+
interface IStyledTabPanelProps {
|
|
9
|
+
isVertical?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const StyledTabPanel: import("styled-components").StyledComponent<"div", DefaultTheme, {
|
|
11
12
|
'data-garden-id': string;
|
|
12
13
|
'data-garden-version': string;
|
|
13
|
-
}, "data-garden-id" | "data-garden-version">;
|
|
14
|
+
} & IStyledTabPanelProps, "data-garden-id" | "data-garden-version">;
|
|
15
|
+
export {};
|
|
@@ -4,15 +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';
|
|
8
7
|
interface IStyledTabsProps {
|
|
9
|
-
/**
|
|
10
|
-
* Displays vertical TabList styling
|
|
11
|
-
*/
|
|
12
8
|
isVertical?: boolean;
|
|
13
9
|
}
|
|
14
10
|
/**
|
|
15
11
|
* Accepts all `<div>` props
|
|
16
12
|
*/
|
|
17
|
-
export declare const StyledTabs: import("styled-components").StyledComponent<"div", DefaultTheme, IStyledTabsProps, never>;
|
|
13
|
+
export declare const StyledTabs: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, IStyledTabsProps, never>;
|
|
18
14
|
export {};
|
|
@@ -6,5 +6,9 @@
|
|
|
6
6
|
*/
|
|
7
7
|
/// <reference types="react" />
|
|
8
8
|
import { IUseTabsReturnValue } from '@zendeskgarden/container-tabs';
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
interface ITabsContext extends IUseTabsReturnValue<any> {
|
|
10
|
+
isVertical?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const TabsContext: import("react").Context<ITabsContext | undefined>;
|
|
13
|
+
export declare const useTabsContext: () => ITabsContext | undefined;
|
|
14
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zendeskgarden/react-tabs",
|
|
3
|
-
"version": "9.0.0-next.
|
|
3
|
+
"version": "9.0.0-next.14",
|
|
4
4
|
"description": "Components and render prop containers relating to the Garden Design System.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Zendesk Garden <garden@zendesk.com>",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"sideEffects": false,
|
|
22
22
|
"types": "dist/typings/index.d.ts",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@zendeskgarden/container-tabs": "^2.0.
|
|
24
|
+
"@zendeskgarden/container-tabs": "^2.0.10",
|
|
25
25
|
"@zendeskgarden/container-utilities": "^2.0.0",
|
|
26
|
-
"polished": "^4.
|
|
26
|
+
"polished": "^4.3.1",
|
|
27
27
|
"prop-types": "^15.5.7",
|
|
28
28
|
"react-merge-refs": "^2.0.0"
|
|
29
29
|
},
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"styled-components": "^5.3.1"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@zendeskgarden/react-theming": "^9.0.0-next.
|
|
37
|
+
"@zendeskgarden/react-theming": "^9.0.0-next.14"
|
|
38
38
|
},
|
|
39
39
|
"keywords": [
|
|
40
40
|
"components",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"zendeskgarden:src": "src/index.ts",
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "4cd4e10839f6d083f0c5e642b99256e390a37ae6"
|
|
50
50
|
}
|