@zendeskgarden/react-tables 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/Cell.js +7 -1
- package/dist/esm/elements/GroupRow.js +1 -1
- package/dist/esm/elements/Head.js +10 -3
- package/dist/esm/elements/HeaderCell.js +7 -1
- package/dist/esm/elements/HeaderRow.js +1 -1
- package/dist/esm/elements/OverflowButton.js +9 -27
- package/dist/esm/elements/Row.js +13 -5
- package/dist/esm/elements/SortableCell.js +13 -5
- package/dist/esm/elements/Table.js +9 -4
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/sort-fill.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/sort-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/overflow-vertical-stroke.svg.js +25 -0
- package/dist/esm/styled/StyledBaseRow.js +46 -0
- package/dist/esm/styled/StyledBody.js +1 -1
- package/dist/esm/styled/StyledCaption.js +1 -1
- package/dist/esm/styled/StyledCell.js +4 -4
- package/dist/esm/styled/StyledGroupRow.js +20 -4
- package/dist/esm/styled/StyledHead.js +19 -6
- package/dist/esm/styled/StyledHeaderCell.js +4 -4
- package/dist/esm/styled/StyledHeaderRow.js +20 -7
- package/dist/esm/styled/StyledHiddenCell.js +1 -1
- package/dist/esm/styled/StyledOverflowButton.js +7 -32
- package/dist/esm/styled/StyledRow.js +71 -27
- package/dist/esm/styled/StyledSortableButton.js +63 -40
- package/dist/esm/styled/StyledTable.js +6 -3
- package/dist/esm/styled/style-utils.js +2 -2
- package/dist/index.cjs.js +398 -263
- package/dist/typings/elements/OverflowButton.d.ts +2 -10
- package/dist/typings/styled/StyledBaseRow.d.ts +11 -0
- package/dist/typings/styled/StyledCell.d.ts +5 -2
- package/dist/typings/styled/StyledGroupRow.d.ts +7 -3
- package/dist/typings/styled/StyledHead.d.ts +1 -1
- package/dist/typings/styled/StyledHeaderRow.d.ts +7 -3
- package/dist/typings/styled/StyledOverflowButton.d.ts +7 -9
- package/dist/typings/styled/StyledRow.d.ts +10 -8
- package/dist/typings/styled/StyledSortableButton.d.ts +5 -4
- package/dist/typings/styled/StyledTable.d.ts +4 -6
- package/dist/typings/styled/index.d.ts +1 -1
- package/dist/typings/styled/style-utils.d.ts +1 -1
- package/package.json +6 -5
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/overflow-stroke.svg.js +0 -36
|
@@ -23,6 +23,9 @@ import { useTableContext } from '../utils/useTableContext.js';
|
|
|
23
23
|
const Cell = React__default.forwardRef((_ref, ref) => {
|
|
24
24
|
let {
|
|
25
25
|
hidden,
|
|
26
|
+
isMinimum,
|
|
27
|
+
isTruncated,
|
|
28
|
+
hasOverflow,
|
|
26
29
|
...props
|
|
27
30
|
} = _ref;
|
|
28
31
|
const {
|
|
@@ -30,7 +33,10 @@ const Cell = React__default.forwardRef((_ref, ref) => {
|
|
|
30
33
|
} = useTableContext();
|
|
31
34
|
return React__default.createElement(StyledCell, Object.assign({
|
|
32
35
|
ref: ref,
|
|
33
|
-
size: size
|
|
36
|
+
$size: size,
|
|
37
|
+
$isMinimum: isMinimum,
|
|
38
|
+
$isTruncated: isTruncated,
|
|
39
|
+
$hasOverflow: hasOverflow
|
|
34
40
|
}, props), hidden && props.children ? React__default.createElement(StyledHiddenCell, null, props.children) : props.children);
|
|
35
41
|
});
|
|
36
42
|
Cell.displayName = 'Cell';
|
|
@@ -18,9 +18,16 @@ import '../styled/StyledSortableButton.js';
|
|
|
18
18
|
import '../styled/StyledOverflowButton.js';
|
|
19
19
|
import '../styled/StyledRow.js';
|
|
20
20
|
|
|
21
|
-
const Head = forwardRef((
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
const Head = forwardRef((_ref, ref) => {
|
|
22
|
+
let {
|
|
23
|
+
isSticky,
|
|
24
|
+
...props
|
|
25
|
+
} = _ref;
|
|
26
|
+
return React__default.createElement(StyledHead, Object.assign({
|
|
27
|
+
ref: ref,
|
|
28
|
+
$isSticky: isSticky
|
|
29
|
+
}, props));
|
|
30
|
+
});
|
|
24
31
|
Head.displayName = 'Head';
|
|
25
32
|
|
|
26
33
|
export { Head };
|
|
@@ -23,6 +23,9 @@ import { Cell } from './Cell.js';
|
|
|
23
23
|
const HeaderCell = forwardRef((_ref, ref) => {
|
|
24
24
|
let {
|
|
25
25
|
hidden,
|
|
26
|
+
isMinimum,
|
|
27
|
+
isTruncated,
|
|
28
|
+
hasOverflow,
|
|
26
29
|
...props
|
|
27
30
|
} = _ref;
|
|
28
31
|
const {
|
|
@@ -30,7 +33,10 @@ const HeaderCell = forwardRef((_ref, ref) => {
|
|
|
30
33
|
} = useTableContext();
|
|
31
34
|
return React__default.createElement(StyledHeaderCell, Object.assign({
|
|
32
35
|
ref: ref,
|
|
33
|
-
size: size
|
|
36
|
+
$size: size,
|
|
37
|
+
$isMinimum: isMinimum,
|
|
38
|
+
$isTruncated: isTruncated,
|
|
39
|
+
$hasOverflow: hasOverflow
|
|
34
40
|
}, props), hidden && props.children ? React__default.createElement(StyledHiddenCell, null, props.children) : props.children);
|
|
35
41
|
});
|
|
36
42
|
HeaderCell.displayName = 'HeaderCell';
|
|
@@ -25,7 +25,7 @@ const HeaderRow = React__default.forwardRef((props, ref) => {
|
|
|
25
25
|
} = useTableContext();
|
|
26
26
|
return React__default.createElement(StyledHeaderRow, Object.assign({
|
|
27
27
|
ref: ref,
|
|
28
|
-
size: size
|
|
28
|
+
$size: size
|
|
29
29
|
}, props));
|
|
30
30
|
});
|
|
31
31
|
HeaderRow.displayName = 'HeaderRow';
|
|
@@ -4,10 +4,8 @@
|
|
|
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, { forwardRef
|
|
8
|
-
import
|
|
9
|
-
import { composeEventHandlers } from '@zendeskgarden/container-utilities';
|
|
10
|
-
import SvgOverflowStroke from '../node_modules/@zendeskgarden/svg-icons/src/16/overflow-stroke.svg.js';
|
|
7
|
+
import React__default, { forwardRef } from 'react';
|
|
8
|
+
import SvgOverflowVerticalStroke from '../node_modules/@zendeskgarden/svg-icons/src/16/overflow-vertical-stroke.svg.js';
|
|
11
9
|
import '../styled/StyledBody.js';
|
|
12
10
|
import '../styled/StyledCaption.js';
|
|
13
11
|
import '../styled/StyledHeaderRow.js';
|
|
@@ -18,38 +16,22 @@ import '../styled/StyledTable.js';
|
|
|
18
16
|
import '../styled/StyledHeaderCell.js';
|
|
19
17
|
import '../styled/StyledHiddenCell.js';
|
|
20
18
|
import '../styled/StyledSortableButton.js';
|
|
21
|
-
import { StyledOverflowButton
|
|
19
|
+
import { StyledOverflowButton } from '../styled/StyledOverflowButton.js';
|
|
22
20
|
import '../styled/StyledRow.js';
|
|
23
21
|
import { useTableContext } from '../utils/useTableContext.js';
|
|
24
22
|
|
|
25
|
-
const OverflowButton = forwardRef((
|
|
26
|
-
let {
|
|
27
|
-
onFocus,
|
|
28
|
-
onBlur,
|
|
29
|
-
isFocused: focused,
|
|
30
|
-
...other
|
|
31
|
-
} = _ref;
|
|
32
|
-
const [isFocused, setIsFocused] = useState(false);
|
|
23
|
+
const OverflowButton = forwardRef((props, ref) => {
|
|
33
24
|
const {
|
|
34
25
|
size
|
|
35
26
|
} = useTableContext();
|
|
36
27
|
return React__default.createElement(StyledOverflowButton, Object.assign({
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}),
|
|
40
|
-
onBlur: composeEventHandlers(onBlur, () => {
|
|
41
|
-
setIsFocused(false);
|
|
42
|
-
}),
|
|
43
|
-
size: size,
|
|
44
|
-
isFocused: typeof focused === 'undefined' ? isFocused : focused,
|
|
28
|
+
type: "button",
|
|
29
|
+
$size: size,
|
|
45
30
|
ref: ref
|
|
46
|
-
},
|
|
31
|
+
}, props, {
|
|
32
|
+
focusInset: true
|
|
33
|
+
}), React__default.createElement(SvgOverflowVerticalStroke, null));
|
|
47
34
|
});
|
|
48
35
|
OverflowButton.displayName = 'OverflowButton';
|
|
49
|
-
OverflowButton.propTypes = {
|
|
50
|
-
isHovered: PropTypes.bool,
|
|
51
|
-
isActive: PropTypes.bool,
|
|
52
|
-
isFocused: PropTypes.bool
|
|
53
|
-
};
|
|
54
36
|
|
|
55
37
|
export { OverflowButton };
|
package/dist/esm/elements/Row.js
CHANGED
|
@@ -25,6 +25,9 @@ const Row = forwardRef((_ref, ref) => {
|
|
|
25
25
|
let {
|
|
26
26
|
onFocus,
|
|
27
27
|
onBlur,
|
|
28
|
+
isSelected,
|
|
29
|
+
isStriped,
|
|
30
|
+
isHovered,
|
|
28
31
|
isFocused: focused,
|
|
29
32
|
...otherProps
|
|
30
33
|
} = _ref;
|
|
@@ -51,11 +54,16 @@ const Row = forwardRef((_ref, ref) => {
|
|
|
51
54
|
return React__default.createElement(StyledRow, Object.assign({
|
|
52
55
|
onFocus: onFocusCallback,
|
|
53
56
|
onBlur: onBlurCallback,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
ref: ref,
|
|
58
|
+
$size: size,
|
|
59
|
+
$isReadOnly: isReadOnly,
|
|
60
|
+
$isFocused: computedFocused,
|
|
61
|
+
$isHovered: isHovered,
|
|
62
|
+
$isStriped: isStriped,
|
|
63
|
+
$isSelected: isSelected
|
|
64
|
+
}, otherProps, {
|
|
65
|
+
tabIndex: isReadOnly ? undefined : -1
|
|
66
|
+
}));
|
|
59
67
|
});
|
|
60
68
|
Row.displayName = 'Row';
|
|
61
69
|
Row.propTypes = {
|
|
@@ -25,11 +25,16 @@ import '../styled/StyledRow.js';
|
|
|
25
25
|
const SortableCell = forwardRef((_ref, ref) => {
|
|
26
26
|
let {
|
|
27
27
|
sort,
|
|
28
|
-
cellProps,
|
|
28
|
+
cellProps = {},
|
|
29
29
|
width,
|
|
30
30
|
children,
|
|
31
|
-
...
|
|
31
|
+
...sortableButtonProps
|
|
32
32
|
} = _ref;
|
|
33
|
+
const {
|
|
34
|
+
isMinimum,
|
|
35
|
+
isTruncated,
|
|
36
|
+
hasOverflow
|
|
37
|
+
} = cellProps;
|
|
33
38
|
let ariaSortValue = 'none';
|
|
34
39
|
if (sort === 'asc') {
|
|
35
40
|
ariaSortValue = 'ascending';
|
|
@@ -39,11 +44,14 @@ const SortableCell = forwardRef((_ref, ref) => {
|
|
|
39
44
|
const SortIcon = sort === undefined ? SvgSortStroke : SvgSortFill;
|
|
40
45
|
return React__default.createElement(StyledHeaderCell, Object.assign({
|
|
41
46
|
"aria-sort": ariaSortValue,
|
|
42
|
-
width: width
|
|
47
|
+
width: width,
|
|
48
|
+
$isMinimum: isMinimum,
|
|
49
|
+
$isTruncated: isTruncated,
|
|
50
|
+
$hasOverflow: hasOverflow
|
|
43
51
|
}, cellProps), React__default.createElement(StyledSortableButton, Object.assign({
|
|
44
|
-
sort: sort,
|
|
52
|
+
$sort: sort,
|
|
45
53
|
ref: ref
|
|
46
|
-
},
|
|
54
|
+
}, sortableButtonProps), children, React__default.createElement(StyledSortableStrokeIconWrapper, null, React__default.createElement(SortIcon, null)), React__default.createElement(StyledSortableFillIconWrapper, null, React__default.createElement(SvgSortFill, null))));
|
|
47
55
|
});
|
|
48
56
|
SortableCell.displayName = 'SortableCell';
|
|
49
57
|
SortableCell.propTypes = {
|
|
@@ -31,11 +31,16 @@ import { OverflowButton } from './OverflowButton.js';
|
|
|
31
31
|
import { Row } from './Row.js';
|
|
32
32
|
import { SortableCell } from './SortableCell.js';
|
|
33
33
|
|
|
34
|
-
const TableComponent = React__default.forwardRef((
|
|
34
|
+
const TableComponent = React__default.forwardRef((_ref, ref) => {
|
|
35
|
+
let {
|
|
36
|
+
isReadOnly,
|
|
37
|
+
size,
|
|
38
|
+
...props
|
|
39
|
+
} = _ref;
|
|
35
40
|
const tableContextValue = useMemo(() => ({
|
|
36
|
-
size:
|
|
37
|
-
isReadOnly:
|
|
38
|
-
}), [
|
|
41
|
+
size: size,
|
|
42
|
+
isReadOnly: isReadOnly
|
|
43
|
+
}), [size, isReadOnly]);
|
|
39
44
|
return React__default.createElement(TableContext.Provider, {
|
|
40
45
|
value: tableContextValue
|
|
41
46
|
}, React__default.createElement(StyledTable, Object.assign({
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
|
|
9
9
|
var _path, _path2;
|
|
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 SvgSortFill = function SvgSortFill(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 SvgSortStroke = function SvgSortStroke(props) {
|
|
12
12
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
13
13
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
|
|
9
|
+
var _path;
|
|
10
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
11
|
+
var SvgOverflowVerticalStroke = function SvgOverflowVerticalStroke(props) {
|
|
12
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
13
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
14
|
+
width: 16,
|
|
15
|
+
height: 16,
|
|
16
|
+
focusable: "false",
|
|
17
|
+
viewBox: "0 0 16 16",
|
|
18
|
+
"aria-hidden": "true"
|
|
19
|
+
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
20
|
+
fill: "currentColor",
|
|
21
|
+
d: "M9.5 2.5a1.5 1.5 0 11-3 0 1.5 1.5 0 013 0zm0 5.5a1.5 1.5 0 11-3 0 1.5 1.5 0 013 0zm0 5.5a1.5 1.5 0 11-3 0 1.5 1.5 0 013 0z"
|
|
22
|
+
})));
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { SvgOverflowVerticalStroke as default };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
|
+
import { DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const sizeStyles = _ref => {
|
|
11
|
+
let {
|
|
12
|
+
theme
|
|
13
|
+
} = _ref;
|
|
14
|
+
return css(["border-bottom:", ";vertical-align:top;box-sizing:border-box;"], theme.borders.sm);
|
|
15
|
+
};
|
|
16
|
+
const colorStyles = _ref2 => {
|
|
17
|
+
let {
|
|
18
|
+
theme,
|
|
19
|
+
$isStriped
|
|
20
|
+
} = _ref2;
|
|
21
|
+
const borderColor = getColor({
|
|
22
|
+
variable: 'border.subtle',
|
|
23
|
+
theme
|
|
24
|
+
});
|
|
25
|
+
const backgroundColor = getColor({
|
|
26
|
+
variable: 'background.subtle',
|
|
27
|
+
transparency: theme.opacity[100],
|
|
28
|
+
light: {
|
|
29
|
+
offset: 300
|
|
30
|
+
},
|
|
31
|
+
dark: {
|
|
32
|
+
offset: -600
|
|
33
|
+
},
|
|
34
|
+
theme
|
|
35
|
+
});
|
|
36
|
+
return css(["border-bottom-color:", ";background-color:", ";"], borderColor, $isStriped && backgroundColor);
|
|
37
|
+
};
|
|
38
|
+
const StyledBaseRow = styled.tr.withConfig({
|
|
39
|
+
displayName: "StyledBaseRow",
|
|
40
|
+
componentId: "sc-1t4zqg4-0"
|
|
41
|
+
})(["display:table-row;transition:background-color 0.1s ease-in-out;", " ", ""], sizeStyles, colorStyles);
|
|
42
|
+
StyledBaseRow.defaultProps = {
|
|
43
|
+
theme: DEFAULT_THEME
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export { StyledBaseRow };
|
|
@@ -10,7 +10,7 @@ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-the
|
|
|
10
10
|
const COMPONENT_ID = 'tables.body';
|
|
11
11
|
const StyledBody = styled.tbody.attrs({
|
|
12
12
|
'data-garden-id': COMPONENT_ID,
|
|
13
|
-
'data-garden-version': '9.0.0-next.
|
|
13
|
+
'data-garden-version': '9.0.0-next.14'
|
|
14
14
|
}).withConfig({
|
|
15
15
|
displayName: "StyledBody",
|
|
16
16
|
componentId: "sc-14ud6y-0"
|
|
@@ -10,7 +10,7 @@ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-the
|
|
|
10
10
|
const COMPONENT_ID = 'tables.caption';
|
|
11
11
|
const StyledCaption = styled.caption.attrs({
|
|
12
12
|
'data-garden-id': COMPONENT_ID,
|
|
13
|
-
'data-garden-version': '9.0.0-next.
|
|
13
|
+
'data-garden-version': '9.0.0-next.14'
|
|
14
14
|
}).withConfig({
|
|
15
15
|
displayName: "StyledCaption",
|
|
16
16
|
componentId: "sc-113y327-0"
|
|
@@ -17,7 +17,7 @@ const sizeStyling = props => {
|
|
|
17
17
|
let padding;
|
|
18
18
|
let width = props.width;
|
|
19
19
|
let height;
|
|
20
|
-
if (props
|
|
20
|
+
if (props.$hasOverflow) {
|
|
21
21
|
boxSizing = 'content-box';
|
|
22
22
|
width = '2em';
|
|
23
23
|
height = 'inherit';
|
|
@@ -27,7 +27,7 @@ const sizeStyling = props => {
|
|
|
27
27
|
const paddingHorizontal = `${props.theme.space.base * 3}px`;
|
|
28
28
|
padding = `${paddingVertical} ${paddingHorizontal}`;
|
|
29
29
|
}
|
|
30
|
-
if (props
|
|
30
|
+
if (props.$isMinimum) {
|
|
31
31
|
boxSizing = 'content-box';
|
|
32
32
|
width = '1em';
|
|
33
33
|
}
|
|
@@ -35,11 +35,11 @@ const sizeStyling = props => {
|
|
|
35
35
|
};
|
|
36
36
|
const StyledCell = styled.td.attrs({
|
|
37
37
|
'data-garden-id': COMPONENT_ID,
|
|
38
|
-
'data-garden-version': '9.0.0-next.
|
|
38
|
+
'data-garden-version': '9.0.0-next.14'
|
|
39
39
|
}).withConfig({
|
|
40
40
|
displayName: "StyledCell",
|
|
41
41
|
componentId: "sc-8hpncx-0"
|
|
42
|
-
})(["display:table-cell;transition:border-color 0.25s ease-in-out,box-shadow 0.1s ease-in-out;", ";", ";", ";"], props => sizeStyling(props), props => props
|
|
42
|
+
})(["display:table-cell;transition:border-color 0.25s ease-in-out,box-shadow 0.1s ease-in-out;", ";", ";", ";"], props => sizeStyling(props), props => props.$isTruncated && truncatedStyling, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
43
43
|
StyledCell.defaultProps = {
|
|
44
44
|
theme: DEFAULT_THEME
|
|
45
45
|
};
|
|
@@ -6,12 +6,28 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import styled, { css } from 'styled-components';
|
|
8
8
|
import { math } from 'polished';
|
|
9
|
-
import {
|
|
10
|
-
import { StyledBaseRow } from './
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
|
|
10
|
+
import { StyledBaseRow } from './StyledBaseRow.js';
|
|
11
11
|
import { StyledCell } from './StyledCell.js';
|
|
12
12
|
import { getLineHeight } from './StyledTable.js';
|
|
13
13
|
|
|
14
14
|
const COMPONENT_ID = 'tables.group_row';
|
|
15
|
+
const colorStyles = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
theme
|
|
18
|
+
} = _ref;
|
|
19
|
+
return css(["background-color:", ";"], getColor({
|
|
20
|
+
variable: 'background.subtle',
|
|
21
|
+
transparency: theme.opacity[100],
|
|
22
|
+
light: {
|
|
23
|
+
offset: 300
|
|
24
|
+
},
|
|
25
|
+
dark: {
|
|
26
|
+
offset: -600
|
|
27
|
+
},
|
|
28
|
+
theme
|
|
29
|
+
}));
|
|
30
|
+
};
|
|
15
31
|
const sizeStyles = props => {
|
|
16
32
|
const height = `${props.theme.space.base * 8}px`;
|
|
17
33
|
const lineHeight = getLineHeight(props);
|
|
@@ -19,11 +35,11 @@ const sizeStyles = props => {
|
|
|
19
35
|
};
|
|
20
36
|
const StyledGroupRow = styled(StyledBaseRow).attrs({
|
|
21
37
|
'data-garden-id': COMPONENT_ID,
|
|
22
|
-
'data-garden-version': '9.0.0-next.
|
|
38
|
+
'data-garden-version': '9.0.0-next.14'
|
|
23
39
|
}).withConfig({
|
|
24
40
|
displayName: "StyledGroupRow",
|
|
25
41
|
componentId: "sc-mpd0r8-0"
|
|
26
|
-
})(["
|
|
42
|
+
})(["", " ", " ", ";"], sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
27
43
|
StyledGroupRow.defaultProps = {
|
|
28
44
|
theme: DEFAULT_THEME
|
|
29
45
|
};
|
|
@@ -5,21 +5,34 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import styled, { css } from 'styled-components';
|
|
8
|
-
import { retrieveComponentStyles, DEFAULT_THEME,
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
|
|
9
9
|
import { StyledHeaderRow } from './StyledHeaderRow.js';
|
|
10
10
|
|
|
11
11
|
const COMPONENT_ID = 'tables.head';
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
const colorStyles = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
theme
|
|
15
|
+
} = _ref;
|
|
16
|
+
const borderColor = getColor({
|
|
17
|
+
variable: 'border.default',
|
|
18
|
+
theme
|
|
19
|
+
});
|
|
20
|
+
const backgroundColor = getColor({
|
|
21
|
+
variable: 'background.default',
|
|
22
|
+
theme
|
|
23
|
+
});
|
|
24
|
+
return css(["box-shadow:inset 0 -", " 0 ", ";background-color:", ";& > ", ":last-child{border-bottom-color:transparent;}"], theme.borderWidths.sm, borderColor, backgroundColor, StyledHeaderRow);
|
|
25
|
+
};
|
|
26
|
+
const stickyStyles = () => {
|
|
27
|
+
return css(["position:sticky;top:0;z-index:1;"]);
|
|
15
28
|
};
|
|
16
29
|
const StyledHead = styled.thead.attrs({
|
|
17
30
|
'data-garden-id': COMPONENT_ID,
|
|
18
|
-
'data-garden-version': '9.0.0-next.
|
|
31
|
+
'data-garden-version': '9.0.0-next.14'
|
|
19
32
|
}).withConfig({
|
|
20
33
|
displayName: "StyledHead",
|
|
21
34
|
componentId: "sc-spf23a-0"
|
|
22
|
-
})(["", " ", ";"], props => props
|
|
35
|
+
})(["", " ", " ", ";"], props => props.$isSticky && stickyStyles(), colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
23
36
|
StyledHead.defaultProps = {
|
|
24
37
|
theme: DEFAULT_THEME
|
|
25
38
|
};
|
|
@@ -16,7 +16,7 @@ const COMPONENT_ID = 'tables.header_cell';
|
|
|
16
16
|
const truncatedStyling = css(["", "{max-width:100%;overflow:hidden;text-overflow:ellipsis;}"], StyledSortableButton);
|
|
17
17
|
const sizeStyles = props => {
|
|
18
18
|
let paddingVertical = undefined;
|
|
19
|
-
if (!props
|
|
19
|
+
if (!props.$hasOverflow) {
|
|
20
20
|
paddingVertical = math(`(${getRowHeight(props)} - ${getLineHeight(props)}) / 2`);
|
|
21
21
|
}
|
|
22
22
|
return css(["padding-top:", ";padding-bottom:", ";"], paddingVertical, paddingVertical);
|
|
@@ -24,19 +24,19 @@ const sizeStyles = props => {
|
|
|
24
24
|
const StyledHeaderCell = styled(StyledCell).attrs({
|
|
25
25
|
as: 'th',
|
|
26
26
|
'data-garden-id': COMPONENT_ID,
|
|
27
|
-
'data-garden-version': '9.0.0-next.
|
|
27
|
+
'data-garden-version': '9.0.0-next.14'
|
|
28
28
|
}).withConfig({
|
|
29
29
|
displayName: "StyledHeaderCell",
|
|
30
30
|
componentId: "sc-fzagoe-0"
|
|
31
31
|
})(["text-align:", ";font-weight:inherit;", " ", " ", ";"], props => {
|
|
32
|
-
if (!props
|
|
32
|
+
if (!props.$hasOverflow) {
|
|
33
33
|
if (props.theme.rtl) {
|
|
34
34
|
return 'right';
|
|
35
35
|
}
|
|
36
36
|
return 'left';
|
|
37
37
|
}
|
|
38
38
|
return undefined;
|
|
39
|
-
}, props => sizeStyles(props), props => props
|
|
39
|
+
}, props => sizeStyles(props), props => props.$isTruncated && truncatedStyling, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
40
40
|
StyledHeaderCell.defaultProps = {
|
|
41
41
|
theme: DEFAULT_THEME
|
|
42
42
|
};
|
|
@@ -4,28 +4,41 @@
|
|
|
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 { StyledBaseRow } from './
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
|
|
10
|
+
import { StyledBaseRow } from './StyledBaseRow.js';
|
|
11
11
|
import { StyledOverflowButton } from './StyledOverflowButton.js';
|
|
12
12
|
|
|
13
13
|
const COMPONENT_ID = 'tables.header_row';
|
|
14
14
|
const getHeaderRowHeight = props => {
|
|
15
|
-
if (props
|
|
15
|
+
if (props.$size === 'large') {
|
|
16
16
|
return `${props.theme.space.base * 18}px`;
|
|
17
|
-
} else if (props
|
|
17
|
+
} else if (props.$size === 'small') {
|
|
18
18
|
return `${props.theme.space.base * 10}px`;
|
|
19
19
|
}
|
|
20
20
|
return `${props.theme.space.base * 12}px`;
|
|
21
21
|
};
|
|
22
|
+
const colorStyles = _ref => {
|
|
23
|
+
let {
|
|
24
|
+
theme
|
|
25
|
+
} = _ref;
|
|
26
|
+
return css(["border-bottom-color:", ";"], getColor({
|
|
27
|
+
variable: 'border.default',
|
|
28
|
+
theme
|
|
29
|
+
}));
|
|
30
|
+
};
|
|
31
|
+
const sizeStyles = props => {
|
|
32
|
+
const rowHeight = getHeaderRowHeight(props);
|
|
33
|
+
return css(["height:", ";vertical-align:bottom;", "{margin-top:0;margin-bottom:calc(", " - 1em);}"], rowHeight, StyledOverflowButton, math(`${rowHeight} / 2`));
|
|
34
|
+
};
|
|
22
35
|
const StyledHeaderRow = styled(StyledBaseRow).attrs({
|
|
23
36
|
'data-garden-id': COMPONENT_ID,
|
|
24
|
-
'data-garden-version': '9.0.0-next.
|
|
37
|
+
'data-garden-version': '9.0.0-next.14'
|
|
25
38
|
}).withConfig({
|
|
26
39
|
displayName: "StyledHeaderRow",
|
|
27
40
|
componentId: "sc-16ogvdx-0"
|
|
28
|
-
})(["
|
|
41
|
+
})(["font-weight:", ";", " ", " ", "{opacity:1;}", ";"], props => props.theme.fontWeights.semibold, sizeStyles, colorStyles, StyledOverflowButton, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
29
42
|
StyledHeaderRow.defaultProps = {
|
|
30
43
|
theme: DEFAULT_THEME
|
|
31
44
|
};
|
|
@@ -11,7 +11,7 @@ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-the
|
|
|
11
11
|
const COMPONENT_ID = 'tables.hidden_cell';
|
|
12
12
|
const StyledHiddenCell = styled.div.attrs({
|
|
13
13
|
'data-garden-id': COMPONENT_ID,
|
|
14
|
-
'data-garden-version': '9.0.0-next.
|
|
14
|
+
'data-garden-version': '9.0.0-next.14'
|
|
15
15
|
}).withConfig({
|
|
16
16
|
displayName: "StyledHiddenCell",
|
|
17
17
|
componentId: "sc-1x454xw-0"
|
|
@@ -4,48 +4,23 @@
|
|
|
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 { math } from 'polished';
|
|
9
|
-
import { retrieveComponentStyles, DEFAULT_THEME
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
10
10
|
import { getRowHeight } from './style-utils.js';
|
|
11
|
+
import { IconButton } from '@zendeskgarden/react-buttons';
|
|
11
12
|
|
|
12
13
|
const COMPONENT_ID = 'tables.overflow_button';
|
|
13
14
|
const OVERFLOW_BUTTON_SIZE = '2em';
|
|
14
|
-
const
|
|
15
|
-
const hoverBackgroundColor = getColorV8('primaryHue', 600, props.theme, 0.08);
|
|
16
|
-
const hoverForegroundColor = getColorV8('neutralHue', 700, props.theme);
|
|
17
|
-
const activeBackgroundColor = getColorV8('primaryHue', 600, props.theme, 0.2);
|
|
18
|
-
const activeForegroundColor = getColorV8('neutralHue', 800, props.theme);
|
|
19
|
-
let foregroundColor;
|
|
20
|
-
if (props.isHovered) {
|
|
21
|
-
foregroundColor = hoverForegroundColor;
|
|
22
|
-
} else if (props.isActive) {
|
|
23
|
-
foregroundColor = activeForegroundColor;
|
|
24
|
-
} else {
|
|
25
|
-
foregroundColor = getColorV8('neutralHue', 600, props.theme);
|
|
26
|
-
}
|
|
27
|
-
return css(["color:", ";&:hover{background-color:", ";color:", ";}", " &:active{background-color:", ";color:", ";}"], foregroundColor, hoverBackgroundColor, hoverForegroundColor, focusStyles({
|
|
28
|
-
theme: props.theme,
|
|
29
|
-
inset: true
|
|
30
|
-
}), activeBackgroundColor, activeForegroundColor);
|
|
31
|
-
};
|
|
32
|
-
const StyledOverflowButton = styled.button.attrs({
|
|
15
|
+
const StyledOverflowButton = styled(IconButton).attrs({
|
|
33
16
|
'data-garden-id': COMPONENT_ID,
|
|
34
|
-
'data-garden-version': '9.0.0-next.
|
|
35
|
-
type: 'button'
|
|
17
|
+
'data-garden-version': '9.0.0-next.14'
|
|
36
18
|
}).withConfig({
|
|
37
19
|
displayName: "StyledOverflowButton",
|
|
38
20
|
componentId: "sc-1eba2ml-0"
|
|
39
|
-
})(["
|
|
21
|
+
})(["margin-top:calc(", " - 1em);width:100%;min-width:unset;height:", ";font-size:inherit;", ";"], props => math(`${getRowHeight(props)} / 2`), OVERFLOW_BUTTON_SIZE, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
40
22
|
StyledOverflowButton.defaultProps = {
|
|
41
23
|
theme: DEFAULT_THEME
|
|
42
24
|
};
|
|
43
|
-
const StyledOverflowButtonIconWrapper = styled.div.withConfig({
|
|
44
|
-
displayName: "StyledOverflowButton__StyledOverflowButtonIconWrapper",
|
|
45
|
-
componentId: "sc-1eba2ml-1"
|
|
46
|
-
})(["display:flex;align-items:center;justify-content:center;transform:rotate(90deg);transition:background-color 0.1s ease-in-out;width:", ";height:", ";"], OVERFLOW_BUTTON_SIZE, OVERFLOW_BUTTON_SIZE);
|
|
47
|
-
StyledOverflowButtonIconWrapper.defaultProps = {
|
|
48
|
-
theme: DEFAULT_THEME
|
|
49
|
-
};
|
|
50
25
|
|
|
51
|
-
export { StyledOverflowButton
|
|
26
|
+
export { StyledOverflowButton };
|