@zendeskgarden/react-tables 9.0.0-next.8 → 9.0.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/Body.js +1 -1
- package/dist/esm/elements/Caption.js +1 -1
- package/dist/esm/elements/Cell.js +8 -2
- package/dist/esm/elements/GroupRow.js +2 -2
- package/dist/esm/elements/Head.js +11 -4
- package/dist/esm/elements/HeaderCell.js +8 -2
- package/dist/esm/elements/HeaderRow.js +2 -2
- package/dist/esm/elements/OverflowButton.js +10 -28
- package/dist/esm/elements/Row.js +14 -6
- package/dist/esm/elements/SortableCell.js +14 -6
- 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 +43 -0
- package/dist/esm/styled/StyledBody.js +2 -5
- package/dist/esm/styled/StyledCaption.js +2 -5
- package/dist/esm/styled/StyledCell.js +5 -8
- package/dist/esm/styled/StyledGroupRow.js +20 -7
- package/dist/esm/styled/StyledHead.js +19 -9
- package/dist/esm/styled/StyledHeaderCell.js +5 -8
- package/dist/esm/styled/StyledHeaderRow.js +20 -10
- package/dist/esm/styled/StyledHiddenCell.js +2 -5
- package/dist/esm/styled/StyledOverflowButton.js +7 -35
- package/dist/esm/styled/StyledRow.js +71 -30
- package/dist/esm/styled/StyledSortableButton.js +62 -51
- package/dist/esm/styled/StyledTable.js +6 -6
- package/dist/esm/styled/style-utils.js +2 -2
- package/dist/index.cjs.js +390 -303
- package/dist/typings/elements/OverflowButton.d.ts +2 -10
- package/dist/typings/elements/Table.d.ts +1 -1
- 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 +6 -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 +8 -8
- package/LICENSE.md +0 -176
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/overflow-stroke.svg.js +0 -36
|
@@ -21,6 +21,6 @@ import '../styled/StyledRow.js';
|
|
|
21
21
|
const Caption = forwardRef((props, ref) => React__default.createElement(StyledCaption, Object.assign({
|
|
22
22
|
ref: ref
|
|
23
23
|
}, props)));
|
|
24
|
-
Caption.displayName = 'Caption';
|
|
24
|
+
Caption.displayName = 'Table.Caption';
|
|
25
25
|
|
|
26
26
|
export { Caption };
|
|
@@ -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,10 +33,13 @@ 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
|
-
Cell.displayName = 'Cell';
|
|
42
|
+
Cell.displayName = 'Table.Cell';
|
|
37
43
|
Cell.propTypes = {
|
|
38
44
|
isMinimum: PropTypes.bool,
|
|
39
45
|
isTruncated: PropTypes.bool,
|
|
@@ -25,9 +25,9 @@ const GroupRow = forwardRef((props, ref) => {
|
|
|
25
25
|
} = useTableContext();
|
|
26
26
|
return React__default.createElement(StyledGroupRow, Object.assign({
|
|
27
27
|
ref: ref,
|
|
28
|
-
size: size
|
|
28
|
+
$size: size
|
|
29
29
|
}, props));
|
|
30
30
|
});
|
|
31
|
-
GroupRow.displayName = 'GroupRow';
|
|
31
|
+
GroupRow.displayName = 'Table.GroupRow';
|
|
32
32
|
|
|
33
33
|
export { GroupRow };
|
|
@@ -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
|
-
|
|
24
|
-
|
|
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
|
+
});
|
|
31
|
+
Head.displayName = 'Table.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,10 +33,13 @@ 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
|
-
HeaderCell.displayName = 'HeaderCell';
|
|
42
|
+
HeaderCell.displayName = 'Table.HeaderCell';
|
|
37
43
|
HeaderCell.propTypes = Cell.propTypes;
|
|
38
44
|
|
|
39
45
|
export { HeaderCell };
|
|
@@ -25,9 +25,9 @@ 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
|
-
HeaderRow.displayName = 'HeaderRow';
|
|
31
|
+
HeaderRow.displayName = 'Table.HeaderRow';
|
|
32
32
|
|
|
33
33
|
export { 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
|
-
OverflowButton.displayName = 'OverflowButton';
|
|
49
|
-
OverflowButton.propTypes = {
|
|
50
|
-
isHovered: PropTypes.bool,
|
|
51
|
-
isActive: PropTypes.bool,
|
|
52
|
-
isFocused: PropTypes.bool
|
|
53
|
-
};
|
|
35
|
+
OverflowButton.displayName = 'Table.OverflowButton';
|
|
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,13 +54,18 @@ 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
|
-
Row.displayName = 'Row';
|
|
68
|
+
Row.displayName = 'Table.Row';
|
|
61
69
|
Row.propTypes = {
|
|
62
70
|
isStriped: PropTypes.bool,
|
|
63
71
|
isFocused: PropTypes.bool,
|
|
@@ -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,13 +44,16 @@ 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
|
-
SortableCell.displayName = 'SortableCell';
|
|
56
|
+
SortableCell.displayName = 'Table.SortableCell';
|
|
49
57
|
SortableCell.propTypes = {
|
|
50
58
|
sort: PropTypes.oneOf(SORT),
|
|
51
59
|
cellProps: PropTypes.any,
|
|
@@ -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,43 @@
|
|
|
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 { 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
|
+
|
|
43
|
+
export { StyledBaseRow };
|
|
@@ -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 = 'tables.body';
|
|
11
11
|
const StyledBody = styled.tbody.attrs({
|
|
12
12
|
'data-garden-id': COMPONENT_ID,
|
|
13
|
-
'data-garden-version': '9.0.0
|
|
13
|
+
'data-garden-version': '9.0.0'
|
|
14
14
|
}).withConfig({
|
|
15
15
|
displayName: "StyledBody",
|
|
16
16
|
componentId: "sc-14ud6y-0"
|
|
17
17
|
})(["", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
18
|
-
StyledBody.defaultProps = {
|
|
19
|
-
theme: DEFAULT_THEME
|
|
20
|
-
};
|
|
21
18
|
|
|
22
19
|
export { StyledBody };
|
|
@@ -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 = 'tables.caption';
|
|
11
11
|
const StyledCaption = styled.caption.attrs({
|
|
12
12
|
'data-garden-id': COMPONENT_ID,
|
|
13
|
-
'data-garden-version': '9.0.0
|
|
13
|
+
'data-garden-version': '9.0.0'
|
|
14
14
|
}).withConfig({
|
|
15
15
|
displayName: "StyledCaption",
|
|
16
16
|
componentId: "sc-113y327-0"
|
|
17
17
|
})(["display:table-caption;text-align:", ";", ";"], props => props.theme.rtl ? 'right' : 'left', props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
18
|
-
StyledCaption.defaultProps = {
|
|
19
|
-
theme: DEFAULT_THEME
|
|
20
|
-
};
|
|
21
18
|
|
|
22
19
|
export { StyledCaption };
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import styled, { css } from 'styled-components';
|
|
8
8
|
import { math } from 'polished';
|
|
9
|
-
import { retrieveComponentStyles
|
|
9
|
+
import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
|
|
10
10
|
import { getLineHeight } from './StyledTable.js';
|
|
11
11
|
import { getRowHeight } from './style-utils.js';
|
|
12
12
|
|
|
@@ -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,13 +35,10 @@ 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
|
|
38
|
+
'data-garden-version': '9.0.0'
|
|
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
|
|
43
|
-
StyledCell.defaultProps = {
|
|
44
|
-
theme: DEFAULT_THEME
|
|
45
|
-
};
|
|
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));
|
|
46
43
|
|
|
47
44
|
export { StyledCell };
|
|
@@ -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, 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,13 +35,10 @@ 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
|
|
38
|
+
'data-garden-version': '9.0.0'
|
|
23
39
|
}).withConfig({
|
|
24
40
|
displayName: "StyledGroupRow",
|
|
25
41
|
componentId: "sc-mpd0r8-0"
|
|
26
|
-
})(["
|
|
27
|
-
StyledGroupRow.defaultProps = {
|
|
28
|
-
theme: DEFAULT_THEME
|
|
29
|
-
};
|
|
42
|
+
})(["", " ", " ", ";"], sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
30
43
|
|
|
31
44
|
export { StyledGroupRow };
|
|
@@ -5,23 +5,33 @@
|
|
|
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,
|
|
8
|
+
import { retrieveComponentStyles, 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
|
|
31
|
+
'data-garden-version': '9.0.0'
|
|
19
32
|
}).withConfig({
|
|
20
33
|
displayName: "StyledHead",
|
|
21
34
|
componentId: "sc-spf23a-0"
|
|
22
|
-
})(["", " ", ";"], props => props
|
|
23
|
-
StyledHead.defaultProps = {
|
|
24
|
-
theme: DEFAULT_THEME
|
|
25
|
-
};
|
|
35
|
+
})(["", " ", " ", ";"], props => props.$isSticky && stickyStyles(), colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
26
36
|
|
|
27
37
|
export { StyledHead };
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import styled, { css } from 'styled-components';
|
|
8
8
|
import { math } from 'polished';
|
|
9
|
-
import { retrieveComponentStyles
|
|
9
|
+
import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
|
|
10
10
|
import { StyledCell } from './StyledCell.js';
|
|
11
11
|
import { StyledSortableButton } from './StyledSortableButton.js';
|
|
12
12
|
import { getLineHeight } from './StyledTable.js';
|
|
@@ -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,21 +24,18 @@ 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
|
|
27
|
+
'data-garden-version': '9.0.0'
|
|
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
|
|
40
|
-
StyledHeaderCell.defaultProps = {
|
|
41
|
-
theme: DEFAULT_THEME
|
|
42
|
-
};
|
|
39
|
+
}, props => sizeStyles(props), props => props.$isTruncated && truncatedStyling, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
43
40
|
|
|
44
41
|
export { StyledHeaderCell };
|
|
@@ -4,30 +4,40 @@
|
|
|
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, 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
|
|
37
|
+
'data-garden-version': '9.0.0'
|
|
25
38
|
}).withConfig({
|
|
26
39
|
displayName: "StyledHeaderRow",
|
|
27
40
|
componentId: "sc-16ogvdx-0"
|
|
28
|
-
})(["
|
|
29
|
-
StyledHeaderRow.defaultProps = {
|
|
30
|
-
theme: DEFAULT_THEME
|
|
31
|
-
};
|
|
41
|
+
})(["font-weight:", ";", " ", " ", "{opacity:1;}", ";"], props => props.theme.fontWeights.semibold, sizeStyles, colorStyles, StyledOverflowButton, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
32
42
|
|
|
33
43
|
export { StyledHeaderRow };
|