@zendeskgarden/react-tabs 9.12.2 → 9.12.4
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 +5 -6
- package/dist/esm/elements/TabPanel.js +4 -5
- package/dist/esm/elements/Tabs.js +7 -8
- package/dist/esm/styled/StyledTab.js +12 -14
- package/dist/esm/styled/StyledTabList.js +12 -14
- package/dist/esm/styled/StyledTabPanel.js +7 -8
- package/dist/esm/styled/StyledTabs.js +1 -1
- package/dist/index.cjs.js +39 -47
- package/package.json +5 -5
package/dist/esm/elements/Tab.js
CHANGED
|
@@ -13,12 +13,11 @@ import '../styled/StyledTabPanel.js';
|
|
|
13
13
|
import '../styled/StyledTabs.js';
|
|
14
14
|
import { useTabsContext } from '../utils/useTabsContext.js';
|
|
15
15
|
|
|
16
|
-
const Tab = React.forwardRef((
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} = _ref;
|
|
16
|
+
const Tab = React.forwardRef(({
|
|
17
|
+
disabled,
|
|
18
|
+
item,
|
|
19
|
+
...otherProps
|
|
20
|
+
}, ref) => {
|
|
22
21
|
const tabsPropGetters = useTabsContext();
|
|
23
22
|
if (disabled || !tabsPropGetters) {
|
|
24
23
|
return React.createElement(StyledTab, Object.assign({
|
|
@@ -12,11 +12,10 @@ import { StyledTabPanel } from '../styled/StyledTabPanel.js';
|
|
|
12
12
|
import '../styled/StyledTabs.js';
|
|
13
13
|
import { useTabsContext } from '../utils/useTabsContext.js';
|
|
14
14
|
|
|
15
|
-
const TabPanel = React.forwardRef((
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} = _ref;
|
|
15
|
+
const TabPanel = React.forwardRef(({
|
|
16
|
+
item,
|
|
17
|
+
...otherProps
|
|
18
|
+
}, ref) => {
|
|
20
19
|
const tabsPropGetters = useTabsContext();
|
|
21
20
|
if (!tabsPropGetters) {
|
|
22
21
|
return React.createElement(StyledTabPanel, Object.assign({
|
|
@@ -17,14 +17,13 @@ import { Tab } from './Tab.js';
|
|
|
17
17
|
import { TabList } from './TabList.js';
|
|
18
18
|
import { TabPanel } from './TabPanel.js';
|
|
19
19
|
|
|
20
|
-
const TabsComponent = forwardRef((
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} = _ref;
|
|
20
|
+
const TabsComponent = forwardRef(({
|
|
21
|
+
isVertical = false,
|
|
22
|
+
children,
|
|
23
|
+
onChange,
|
|
24
|
+
selectedItem: controlledSelectedItem,
|
|
25
|
+
...otherProps
|
|
26
|
+
}, ref) => {
|
|
28
27
|
const theme = useContext(ThemeContext) || DEFAULT_THEME;
|
|
29
28
|
const [internalSelectedItem, setInternalSelectedItem] = useState();
|
|
30
29
|
const selectedItem = getControlledValue(controlledSelectedItem, internalSelectedItem);
|
|
@@ -8,12 +8,11 @@ import styled, { css } from 'styled-components';
|
|
|
8
8
|
import { componentStyles, getColor, focusStyles } from '@zendeskgarden/react-theming';
|
|
9
9
|
import { stripUnit } from 'polished';
|
|
10
10
|
|
|
11
|
-
const COMPONENT_ID = 'tabs.tab';
|
|
12
|
-
const colorStyles =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
} = _ref;
|
|
11
|
+
const COMPONENT_ID$3 = 'tabs.tab';
|
|
12
|
+
const colorStyles$1 = ({
|
|
13
|
+
theme,
|
|
14
|
+
$isSelected
|
|
15
|
+
}) => {
|
|
17
16
|
const borderColor = $isSelected ? getColor({
|
|
18
17
|
theme,
|
|
19
18
|
variable: 'border.primaryEmphasis'
|
|
@@ -38,11 +37,10 @@ const colorStyles = _ref => {
|
|
|
38
37
|
}
|
|
39
38
|
}), selectedColor, disabledColor);
|
|
40
39
|
};
|
|
41
|
-
const sizeStyles =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
} = _ref2;
|
|
40
|
+
const sizeStyles$2 = ({
|
|
41
|
+
theme,
|
|
42
|
+
$isVertical
|
|
43
|
+
}) => {
|
|
46
44
|
const borderWidth = theme.borderWidths.md;
|
|
47
45
|
const focusHeight = `calc(100% - ${theme.space.base * ($isVertical ? 2 : 4)}px);`;
|
|
48
46
|
let marginBottom;
|
|
@@ -59,8 +57,8 @@ const sizeStyles = _ref2 => {
|
|
|
59
57
|
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);
|
|
60
58
|
};
|
|
61
59
|
const StyledTab = styled.div.attrs({
|
|
62
|
-
'data-garden-id': COMPONENT_ID,
|
|
63
|
-
'data-garden-version': '9.12.
|
|
60
|
+
'data-garden-id': COMPONENT_ID$3,
|
|
61
|
+
'data-garden-version': '9.12.4'
|
|
64
62
|
}).withConfig({
|
|
65
63
|
displayName: "StyledTab",
|
|
66
64
|
componentId: "sc-x2pbow-0"
|
|
@@ -69,6 +67,6 @@ const StyledTab = styled.div.attrs({
|
|
|
69
67
|
return props.theme.rtl ? 'right' : 'left';
|
|
70
68
|
}
|
|
71
69
|
return 'center';
|
|
72
|
-
}, 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, componentStyles);
|
|
70
|
+
}, 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, componentStyles);
|
|
73
71
|
|
|
74
72
|
export { StyledTab };
|
|
@@ -5,13 +5,12 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import styled, { css } from 'styled-components';
|
|
8
|
-
import { componentStyles,
|
|
8
|
+
import { componentStyles, getLineHeight, getColor } from '@zendeskgarden/react-theming';
|
|
9
9
|
|
|
10
|
-
const COMPONENT_ID = 'tabs.tablist';
|
|
11
|
-
const colorStyles =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} = _ref;
|
|
10
|
+
const COMPONENT_ID$2 = 'tabs.tablist';
|
|
11
|
+
const colorStyles = ({
|
|
12
|
+
theme
|
|
13
|
+
}) => {
|
|
15
14
|
const borderColor = getColor({
|
|
16
15
|
theme,
|
|
17
16
|
variable: 'border.default'
|
|
@@ -22,11 +21,10 @@ const colorStyles = _ref => {
|
|
|
22
21
|
});
|
|
23
22
|
return css(["transition:border-color 0.25s ease-in-out;color-scheme:only ", ";border-bottom-color:", ";color:", ";"], p => p.theme.colors.base, borderColor, foregroundColor);
|
|
24
23
|
};
|
|
25
|
-
const sizeStyles =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
} = _ref2;
|
|
24
|
+
const sizeStyles$1 = ({
|
|
25
|
+
theme,
|
|
26
|
+
$isVertical
|
|
27
|
+
}) => {
|
|
30
28
|
const marginBottom = $isVertical ? 0 : `${theme.space.base * 5}px`;
|
|
31
29
|
const borderBottom = $isVertical ? undefined : theme.borderWidths.sm;
|
|
32
30
|
const fontSize = theme.fontSizes.md;
|
|
@@ -34,11 +32,11 @@ const sizeStyles = _ref2 => {
|
|
|
34
32
|
return css(["margin-top:0;margin-bottom:", ";border-bottom-width:", ";padding:0;line-height:", ";font-size:", ";"], marginBottom, borderBottom, lineHeight, fontSize);
|
|
35
33
|
};
|
|
36
34
|
const StyledTabList = styled.div.attrs({
|
|
37
|
-
'data-garden-id': COMPONENT_ID,
|
|
38
|
-
'data-garden-version': '9.12.
|
|
35
|
+
'data-garden-id': COMPONENT_ID$2,
|
|
36
|
+
'data-garden-version': '9.12.4'
|
|
39
37
|
}).withConfig({
|
|
40
38
|
displayName: "StyledTabList",
|
|
41
39
|
componentId: "sc-wa5aaj-0"
|
|
42
|
-
})(["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, componentStyles);
|
|
40
|
+
})(["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, componentStyles);
|
|
43
41
|
|
|
44
42
|
export { StyledTabList };
|
|
@@ -7,18 +7,17 @@
|
|
|
7
7
|
import styled, { css } from 'styled-components';
|
|
8
8
|
import { componentStyles } from '@zendeskgarden/react-theming';
|
|
9
9
|
|
|
10
|
-
const COMPONENT_ID = 'tabs.tabpanel';
|
|
11
|
-
const sizeStyles =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
} = _ref;
|
|
10
|
+
const COMPONENT_ID$1 = 'tabs.tabpanel';
|
|
11
|
+
const sizeStyles = ({
|
|
12
|
+
theme,
|
|
13
|
+
$isVertical
|
|
14
|
+
}) => {
|
|
16
15
|
const margin = $isVertical ? `${theme.space.base * 8}px` : undefined;
|
|
17
16
|
return css(["margin-", ":", ";"], theme.rtl ? 'right' : 'left', margin);
|
|
18
17
|
};
|
|
19
18
|
const StyledTabPanel = styled.div.attrs({
|
|
20
|
-
'data-garden-id': COMPONENT_ID,
|
|
21
|
-
'data-garden-version': '9.12.
|
|
19
|
+
'data-garden-id': COMPONENT_ID$1,
|
|
20
|
+
'data-garden-version': '9.12.4'
|
|
22
21
|
}).withConfig({
|
|
23
22
|
displayName: "StyledTabPanel",
|
|
24
23
|
componentId: "sc-7lhrmp-0"
|
|
@@ -10,7 +10,7 @@ import { componentStyles } from '@zendeskgarden/react-theming';
|
|
|
10
10
|
const COMPONENT_ID = 'tabs.tabs';
|
|
11
11
|
const StyledTabs = styled.div.attrs({
|
|
12
12
|
'data-garden-id': COMPONENT_ID,
|
|
13
|
-
'data-garden-version': '9.12.
|
|
13
|
+
'data-garden-version': '9.12.4'
|
|
14
14
|
}).withConfig({
|
|
15
15
|
displayName: "StyledTabs",
|
|
16
16
|
componentId: "sc-1qaor65-0"
|
package/dist/index.cjs.js
CHANGED
|
@@ -22,11 +22,10 @@ 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$1 =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
} = _ref;
|
|
25
|
+
const colorStyles$1 = ({
|
|
26
|
+
theme,
|
|
27
|
+
$isSelected
|
|
28
|
+
}) => {
|
|
30
29
|
const borderColor = $isSelected ? reactTheming.getColor({
|
|
31
30
|
theme,
|
|
32
31
|
variable: 'border.primaryEmphasis'
|
|
@@ -51,11 +50,10 @@ const colorStyles$1 = _ref => {
|
|
|
51
50
|
}
|
|
52
51
|
}), selectedColor, disabledColor);
|
|
53
52
|
};
|
|
54
|
-
const sizeStyles$2 =
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
} = _ref2;
|
|
53
|
+
const sizeStyles$2 = ({
|
|
54
|
+
theme,
|
|
55
|
+
$isVertical
|
|
56
|
+
}) => {
|
|
59
57
|
const borderWidth = theme.borderWidths.md;
|
|
60
58
|
const focusHeight = `calc(100% - ${theme.space.base * ($isVertical ? 2 : 4)}px);`;
|
|
61
59
|
let marginBottom;
|
|
@@ -73,7 +71,7 @@ const sizeStyles$2 = _ref2 => {
|
|
|
73
71
|
};
|
|
74
72
|
const StyledTab = styled__default.default.div.attrs({
|
|
75
73
|
'data-garden-id': COMPONENT_ID$3,
|
|
76
|
-
'data-garden-version': '9.12.
|
|
74
|
+
'data-garden-version': '9.12.4'
|
|
77
75
|
}).withConfig({
|
|
78
76
|
displayName: "StyledTab",
|
|
79
77
|
componentId: "sc-x2pbow-0"
|
|
@@ -85,10 +83,9 @@ const StyledTab = styled__default.default.div.attrs({
|
|
|
85
83
|
}, 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, reactTheming.componentStyles);
|
|
86
84
|
|
|
87
85
|
const COMPONENT_ID$2 = 'tabs.tablist';
|
|
88
|
-
const colorStyles =
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
} = _ref;
|
|
86
|
+
const colorStyles = ({
|
|
87
|
+
theme
|
|
88
|
+
}) => {
|
|
92
89
|
const borderColor = reactTheming.getColor({
|
|
93
90
|
theme,
|
|
94
91
|
variable: 'border.default'
|
|
@@ -99,11 +96,10 @@ const colorStyles = _ref => {
|
|
|
99
96
|
});
|
|
100
97
|
return styled.css(["transition:border-color 0.25s ease-in-out;color-scheme:only ", ";border-bottom-color:", ";color:", ";"], p => p.theme.colors.base, borderColor, foregroundColor);
|
|
101
98
|
};
|
|
102
|
-
const sizeStyles$1 =
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
} = _ref2;
|
|
99
|
+
const sizeStyles$1 = ({
|
|
100
|
+
theme,
|
|
101
|
+
$isVertical
|
|
102
|
+
}) => {
|
|
107
103
|
const marginBottom = $isVertical ? 0 : `${theme.space.base * 5}px`;
|
|
108
104
|
const borderBottom = $isVertical ? undefined : theme.borderWidths.sm;
|
|
109
105
|
const fontSize = theme.fontSizes.md;
|
|
@@ -112,24 +108,23 @@ const sizeStyles$1 = _ref2 => {
|
|
|
112
108
|
};
|
|
113
109
|
const StyledTabList = styled__default.default.div.attrs({
|
|
114
110
|
'data-garden-id': COMPONENT_ID$2,
|
|
115
|
-
'data-garden-version': '9.12.
|
|
111
|
+
'data-garden-version': '9.12.4'
|
|
116
112
|
}).withConfig({
|
|
117
113
|
displayName: "StyledTabList",
|
|
118
114
|
componentId: "sc-wa5aaj-0"
|
|
119
115
|
})(["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, reactTheming.componentStyles);
|
|
120
116
|
|
|
121
117
|
const COMPONENT_ID$1 = 'tabs.tabpanel';
|
|
122
|
-
const sizeStyles =
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
} = _ref;
|
|
118
|
+
const sizeStyles = ({
|
|
119
|
+
theme,
|
|
120
|
+
$isVertical
|
|
121
|
+
}) => {
|
|
127
122
|
const margin = $isVertical ? `${theme.space.base * 8}px` : undefined;
|
|
128
123
|
return styled.css(["margin-", ":", ";"], theme.rtl ? 'right' : 'left', margin);
|
|
129
124
|
};
|
|
130
125
|
const StyledTabPanel = styled__default.default.div.attrs({
|
|
131
126
|
'data-garden-id': COMPONENT_ID$1,
|
|
132
|
-
'data-garden-version': '9.12.
|
|
127
|
+
'data-garden-version': '9.12.4'
|
|
133
128
|
}).withConfig({
|
|
134
129
|
displayName: "StyledTabPanel",
|
|
135
130
|
componentId: "sc-7lhrmp-0"
|
|
@@ -138,7 +133,7 @@ const StyledTabPanel = styled__default.default.div.attrs({
|
|
|
138
133
|
const COMPONENT_ID = 'tabs.tabs';
|
|
139
134
|
const StyledTabs = styled__default.default.div.attrs({
|
|
140
135
|
'data-garden-id': COMPONENT_ID,
|
|
141
|
-
'data-garden-version': '9.12.
|
|
136
|
+
'data-garden-version': '9.12.4'
|
|
142
137
|
}).withConfig({
|
|
143
138
|
displayName: "StyledTabs",
|
|
144
139
|
componentId: "sc-1qaor65-0"
|
|
@@ -149,12 +144,11 @@ const useTabsContext = () => {
|
|
|
149
144
|
return React.useContext(TabsContext);
|
|
150
145
|
};
|
|
151
146
|
|
|
152
|
-
const Tab = React__default.default.forwardRef((
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
} = _ref;
|
|
147
|
+
const Tab = React__default.default.forwardRef(({
|
|
148
|
+
disabled,
|
|
149
|
+
item,
|
|
150
|
+
...otherProps
|
|
151
|
+
}, ref) => {
|
|
158
152
|
const tabsPropGetters = useTabsContext();
|
|
159
153
|
if (disabled || !tabsPropGetters) {
|
|
160
154
|
return React__default.default.createElement(StyledTab, Object.assign({
|
|
@@ -199,11 +193,10 @@ const TabList = React__default.default.forwardRef((props, ref) => {
|
|
|
199
193
|
});
|
|
200
194
|
TabList.displayName = 'Tabs.TabList';
|
|
201
195
|
|
|
202
|
-
const TabPanel = React__default.default.forwardRef((
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
} = _ref;
|
|
196
|
+
const TabPanel = React__default.default.forwardRef(({
|
|
197
|
+
item,
|
|
198
|
+
...otherProps
|
|
199
|
+
}, ref) => {
|
|
207
200
|
const tabsPropGetters = useTabsContext();
|
|
208
201
|
if (!tabsPropGetters) {
|
|
209
202
|
return React__default.default.createElement(StyledTabPanel, Object.assign({
|
|
@@ -242,14 +235,13 @@ const toTabs = children => React.Children.toArray(children).reduce((_items, chil
|
|
|
242
235
|
return retVal;
|
|
243
236
|
}, []);
|
|
244
237
|
|
|
245
|
-
const TabsComponent = React.forwardRef((
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
} = _ref;
|
|
238
|
+
const TabsComponent = React.forwardRef(({
|
|
239
|
+
isVertical = false,
|
|
240
|
+
children,
|
|
241
|
+
onChange,
|
|
242
|
+
selectedItem: controlledSelectedItem,
|
|
243
|
+
...otherProps
|
|
244
|
+
}, ref) => {
|
|
253
245
|
const theme = React.useContext(styled.ThemeContext) || reactTheming.DEFAULT_THEME;
|
|
254
246
|
const [internalSelectedItem, setInternalSelectedItem] = React.useState();
|
|
255
247
|
const selectedItem = containerUtilities.getControlledValue(controlledSelectedItem, internalSelectedItem);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zendeskgarden/react-tabs",
|
|
3
|
-
"version": "9.12.
|
|
3
|
+
"version": "9.12.4",
|
|
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,8 +21,8 @@
|
|
|
21
21
|
"sideEffects": false,
|
|
22
22
|
"types": "dist/typings/index.d.ts",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@zendeskgarden/container-tabs": "^2.0.
|
|
25
|
-
"@zendeskgarden/container-utilities": "^2.0.
|
|
24
|
+
"@zendeskgarden/container-tabs": "^2.0.16",
|
|
25
|
+
"@zendeskgarden/container-utilities": "^2.0.4",
|
|
26
26
|
"polished": "^4.3.1",
|
|
27
27
|
"prop-types": "^15.5.7",
|
|
28
28
|
"react-merge-refs": "^2.0.0"
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"styled-components": "^5.3.1 || ^6.0.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@zendeskgarden/react-theming": "^9.12.
|
|
37
|
+
"@zendeskgarden/react-theming": "^9.12.4"
|
|
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": "e79e9687e6bcbd097c059add2938cdae59a5173b"
|
|
50
50
|
}
|