@zendeskgarden/react-tables 9.0.0-next.2 → 9.0.0-next.21
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/README.md +24 -33
- package/dist/esm/elements/Body.js +26 -0
- package/dist/esm/elements/Caption.js +26 -0
- package/dist/esm/elements/Cell.js +50 -0
- package/dist/esm/elements/GroupRow.js +33 -0
- package/dist/esm/elements/Head.js +33 -0
- package/dist/esm/elements/HeaderCell.js +45 -0
- package/dist/esm/elements/HeaderRow.js +33 -0
- package/dist/esm/elements/OverflowButton.js +37 -0
- package/dist/esm/elements/Row.js +76 -0
- package/dist/esm/elements/SortableCell.js +63 -0
- package/dist/esm/elements/Table.js +70 -0
- package/dist/esm/index.js +17 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/sort-fill.svg.js +27 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/sort-stroke.svg.js +27 -0
- 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 +22 -0
- package/dist/esm/styled/StyledCaption.js +22 -0
- package/dist/esm/styled/StyledCell.js +47 -0
- package/dist/esm/styled/StyledGroupRow.js +47 -0
- package/dist/esm/styled/StyledHead.js +40 -0
- package/dist/esm/styled/StyledHeaderCell.js +44 -0
- package/dist/esm/styled/StyledHeaderRow.js +46 -0
- package/dist/esm/styled/StyledHiddenCell.js +23 -0
- package/dist/esm/styled/StyledOverflowButton.js +26 -0
- package/dist/esm/styled/StyledRow.js +106 -0
- package/dist/esm/styled/StyledSortableButton.js +104 -0
- package/dist/esm/styled/StyledTable.js +28 -0
- package/dist/esm/styled/style-utils.js +16 -0
- package/dist/esm/types/index.js +10 -0
- package/dist/esm/utils/useTableContext.js +17 -0
- package/dist/index.cjs.js +438 -308
- package/dist/typings/elements/Body.d.ts +2 -0
- package/dist/typings/elements/Caption.d.ts +2 -0
- package/dist/typings/elements/Cell.d.ts +2 -0
- package/dist/typings/elements/GroupRow.d.ts +2 -0
- package/dist/typings/elements/Head.d.ts +2 -0
- package/dist/typings/elements/HeaderCell.d.ts +2 -0
- package/dist/typings/elements/HeaderRow.d.ts +2 -0
- package/dist/typings/elements/OverflowButton.d.ts +4 -10
- package/dist/typings/elements/Row.d.ts +2 -0
- package/dist/typings/elements/SortableCell.d.ts +2 -0
- package/dist/typings/elements/Table.d.ts +23 -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/StyledHeaderCell.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 +9 -8
- package/dist/index.esm.js +0 -637
|
@@ -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 };
|
|
@@ -0,0 +1,22 @@
|
|
|
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 from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const COMPONENT_ID = 'tables.body';
|
|
11
|
+
const StyledBody = styled.tbody.attrs({
|
|
12
|
+
'data-garden-id': COMPONENT_ID,
|
|
13
|
+
'data-garden-version': '9.0.0-next.21'
|
|
14
|
+
}).withConfig({
|
|
15
|
+
displayName: "StyledBody",
|
|
16
|
+
componentId: "sc-14ud6y-0"
|
|
17
|
+
})(["", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
18
|
+
StyledBody.defaultProps = {
|
|
19
|
+
theme: DEFAULT_THEME
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { StyledBody };
|
|
@@ -0,0 +1,22 @@
|
|
|
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 from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const COMPONENT_ID = 'tables.caption';
|
|
11
|
+
const StyledCaption = styled.caption.attrs({
|
|
12
|
+
'data-garden-id': COMPONENT_ID,
|
|
13
|
+
'data-garden-version': '9.0.0-next.21'
|
|
14
|
+
}).withConfig({
|
|
15
|
+
displayName: "StyledCaption",
|
|
16
|
+
componentId: "sc-113y327-0"
|
|
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
|
+
|
|
22
|
+
export { StyledCaption };
|
|
@@ -0,0 +1,47 @@
|
|
|
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 { math } from 'polished';
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
10
|
+
import { getLineHeight } from './StyledTable.js';
|
|
11
|
+
import { getRowHeight } from './style-utils.js';
|
|
12
|
+
|
|
13
|
+
const COMPONENT_ID = 'tables.cell';
|
|
14
|
+
const truncatedStyling = css(["overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"]);
|
|
15
|
+
const sizeStyling = props => {
|
|
16
|
+
let boxSizing = 'border-box';
|
|
17
|
+
let padding;
|
|
18
|
+
let width = props.width;
|
|
19
|
+
let height;
|
|
20
|
+
if (props.$hasOverflow) {
|
|
21
|
+
boxSizing = 'content-box';
|
|
22
|
+
width = '2em';
|
|
23
|
+
height = 'inherit';
|
|
24
|
+
padding = props.theme.rtl ? `0 0 0 ${props.theme.space.base}px` : `0 ${props.theme.space.base}px 0 0`;
|
|
25
|
+
} else {
|
|
26
|
+
const paddingVertical = math(`(${getRowHeight(props)} - ${getLineHeight(props)}) / 2`);
|
|
27
|
+
const paddingHorizontal = `${props.theme.space.base * 3}px`;
|
|
28
|
+
padding = `${paddingVertical} ${paddingHorizontal}`;
|
|
29
|
+
}
|
|
30
|
+
if (props.$isMinimum) {
|
|
31
|
+
boxSizing = 'content-box';
|
|
32
|
+
width = '1em';
|
|
33
|
+
}
|
|
34
|
+
return css(["box-sizing:", ";padding:", ";width:", ";height:", ";"], boxSizing, padding, width, height);
|
|
35
|
+
};
|
|
36
|
+
const StyledCell = styled.td.attrs({
|
|
37
|
+
'data-garden-id': COMPONENT_ID,
|
|
38
|
+
'data-garden-version': '9.0.0-next.21'
|
|
39
|
+
}).withConfig({
|
|
40
|
+
displayName: "StyledCell",
|
|
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.$isTruncated && truncatedStyling, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
43
|
+
StyledCell.defaultProps = {
|
|
44
|
+
theme: DEFAULT_THEME
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export { StyledCell };
|
|
@@ -0,0 +1,47 @@
|
|
|
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 { math } from 'polished';
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
|
|
10
|
+
import { StyledBaseRow } from './StyledBaseRow.js';
|
|
11
|
+
import { StyledCell } from './StyledCell.js';
|
|
12
|
+
import { getLineHeight } from './StyledTable.js';
|
|
13
|
+
|
|
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
|
+
};
|
|
31
|
+
const sizeStyles = props => {
|
|
32
|
+
const height = `${props.theme.space.base * 8}px`;
|
|
33
|
+
const lineHeight = getLineHeight(props);
|
|
34
|
+
return css(["height:", ";line-height:", ";font-size:", ";", "{padding:", " ", "px;}"], height, lineHeight, props.theme.fontSizes.sm, StyledCell, math(`(${height} - ${lineHeight}) / 2`), props.theme.space.base * 3);
|
|
35
|
+
};
|
|
36
|
+
const StyledGroupRow = styled(StyledBaseRow).attrs({
|
|
37
|
+
'data-garden-id': COMPONENT_ID,
|
|
38
|
+
'data-garden-version': '9.0.0-next.21'
|
|
39
|
+
}).withConfig({
|
|
40
|
+
displayName: "StyledGroupRow",
|
|
41
|
+
componentId: "sc-mpd0r8-0"
|
|
42
|
+
})(["", " ", " ", ";"], sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
43
|
+
StyledGroupRow.defaultProps = {
|
|
44
|
+
theme: DEFAULT_THEME
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export { StyledGroupRow };
|
|
@@ -0,0 +1,40 @@
|
|
|
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 { retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { StyledHeaderRow } from './StyledHeaderRow.js';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'tables.head';
|
|
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;"]);
|
|
28
|
+
};
|
|
29
|
+
const StyledHead = styled.thead.attrs({
|
|
30
|
+
'data-garden-id': COMPONENT_ID,
|
|
31
|
+
'data-garden-version': '9.0.0-next.21'
|
|
32
|
+
}).withConfig({
|
|
33
|
+
displayName: "StyledHead",
|
|
34
|
+
componentId: "sc-spf23a-0"
|
|
35
|
+
})(["", " ", " ", ";"], props => props.$isSticky && stickyStyles(), colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
36
|
+
StyledHead.defaultProps = {
|
|
37
|
+
theme: DEFAULT_THEME
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export { StyledHead };
|
|
@@ -0,0 +1,44 @@
|
|
|
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 { math } from 'polished';
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
10
|
+
import { StyledCell } from './StyledCell.js';
|
|
11
|
+
import { StyledSortableButton } from './StyledSortableButton.js';
|
|
12
|
+
import { getLineHeight } from './StyledTable.js';
|
|
13
|
+
import { getRowHeight } from './style-utils.js';
|
|
14
|
+
|
|
15
|
+
const COMPONENT_ID = 'tables.header_cell';
|
|
16
|
+
const truncatedStyling = css(["", "{max-width:100%;overflow:hidden;text-overflow:ellipsis;}"], StyledSortableButton);
|
|
17
|
+
const sizeStyles = props => {
|
|
18
|
+
let paddingVertical = undefined;
|
|
19
|
+
if (!props.$hasOverflow) {
|
|
20
|
+
paddingVertical = math(`(${getRowHeight(props)} - ${getLineHeight(props)}) / 2`);
|
|
21
|
+
}
|
|
22
|
+
return css(["padding-top:", ";padding-bottom:", ";"], paddingVertical, paddingVertical);
|
|
23
|
+
};
|
|
24
|
+
const StyledHeaderCell = styled(StyledCell).attrs({
|
|
25
|
+
as: 'th',
|
|
26
|
+
'data-garden-id': COMPONENT_ID,
|
|
27
|
+
'data-garden-version': '9.0.0-next.21'
|
|
28
|
+
}).withConfig({
|
|
29
|
+
displayName: "StyledHeaderCell",
|
|
30
|
+
componentId: "sc-fzagoe-0"
|
|
31
|
+
})(["text-align:", ";font-weight:inherit;", " ", " ", ";"], props => {
|
|
32
|
+
if (!props.$hasOverflow) {
|
|
33
|
+
if (props.theme.rtl) {
|
|
34
|
+
return 'right';
|
|
35
|
+
}
|
|
36
|
+
return 'left';
|
|
37
|
+
}
|
|
38
|
+
return undefined;
|
|
39
|
+
}, props => sizeStyles(props), props => props.$isTruncated && truncatedStyling, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
40
|
+
StyledHeaderCell.defaultProps = {
|
|
41
|
+
theme: DEFAULT_THEME
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { StyledHeaderCell };
|
|
@@ -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 { math } from 'polished';
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
|
|
10
|
+
import { StyledBaseRow } from './StyledBaseRow.js';
|
|
11
|
+
import { StyledOverflowButton } from './StyledOverflowButton.js';
|
|
12
|
+
|
|
13
|
+
const COMPONENT_ID = 'tables.header_row';
|
|
14
|
+
const getHeaderRowHeight = props => {
|
|
15
|
+
if (props.$size === 'large') {
|
|
16
|
+
return `${props.theme.space.base * 18}px`;
|
|
17
|
+
} else if (props.$size === 'small') {
|
|
18
|
+
return `${props.theme.space.base * 10}px`;
|
|
19
|
+
}
|
|
20
|
+
return `${props.theme.space.base * 12}px`;
|
|
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
|
+
};
|
|
35
|
+
const StyledHeaderRow = styled(StyledBaseRow).attrs({
|
|
36
|
+
'data-garden-id': COMPONENT_ID,
|
|
37
|
+
'data-garden-version': '9.0.0-next.21'
|
|
38
|
+
}).withConfig({
|
|
39
|
+
displayName: "StyledHeaderRow",
|
|
40
|
+
componentId: "sc-16ogvdx-0"
|
|
41
|
+
})(["font-weight:", ";", " ", " ", "{opacity:1;}", ";"], props => props.theme.fontWeights.semibold, sizeStyles, colorStyles, StyledOverflowButton, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
42
|
+
StyledHeaderRow.defaultProps = {
|
|
43
|
+
theme: DEFAULT_THEME
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export { StyledHeaderRow };
|
|
@@ -0,0 +1,23 @@
|
|
|
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 from 'styled-components';
|
|
8
|
+
import { hideVisually } from 'polished';
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'tables.hidden_cell';
|
|
12
|
+
const StyledHiddenCell = styled.div.attrs({
|
|
13
|
+
'data-garden-id': COMPONENT_ID,
|
|
14
|
+
'data-garden-version': '9.0.0-next.21'
|
|
15
|
+
}).withConfig({
|
|
16
|
+
displayName: "StyledHiddenCell",
|
|
17
|
+
componentId: "sc-1x454xw-0"
|
|
18
|
+
})(["", " ", ";"], hideVisually(), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
19
|
+
StyledHiddenCell.defaultProps = {
|
|
20
|
+
theme: DEFAULT_THEME
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { StyledHiddenCell };
|
|
@@ -0,0 +1,26 @@
|
|
|
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 from 'styled-components';
|
|
8
|
+
import { math } from 'polished';
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
10
|
+
import { getRowHeight } from './style-utils.js';
|
|
11
|
+
import { IconButton } from '@zendeskgarden/react-buttons';
|
|
12
|
+
|
|
13
|
+
const COMPONENT_ID = 'tables.overflow_button';
|
|
14
|
+
const OVERFLOW_BUTTON_SIZE = '2em';
|
|
15
|
+
const StyledOverflowButton = styled(IconButton).attrs({
|
|
16
|
+
'data-garden-id': COMPONENT_ID,
|
|
17
|
+
'data-garden-version': '9.0.0-next.21'
|
|
18
|
+
}).withConfig({
|
|
19
|
+
displayName: "StyledOverflowButton",
|
|
20
|
+
componentId: "sc-1eba2ml-0"
|
|
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));
|
|
22
|
+
StyledOverflowButton.defaultProps = {
|
|
23
|
+
theme: DEFAULT_THEME
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { StyledOverflowButton };
|
|
@@ -0,0 +1,106 @@
|
|
|
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 { retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { StyledCell } from './StyledCell.js';
|
|
10
|
+
import { StyledBaseRow } from './StyledBaseRow.js';
|
|
11
|
+
import { StyledOverflowButton } from './StyledOverflowButton.js';
|
|
12
|
+
import { getRowHeight } from './style-utils.js';
|
|
13
|
+
|
|
14
|
+
const COMPONENT_ID = 'tables.row';
|
|
15
|
+
const colorStyles = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
theme,
|
|
18
|
+
$isFocused,
|
|
19
|
+
$isSelected,
|
|
20
|
+
$isHovered,
|
|
21
|
+
$isReadOnly
|
|
22
|
+
} = _ref;
|
|
23
|
+
const hoveredBackgroundColor = getColor({
|
|
24
|
+
variable: 'background.primaryEmphasis',
|
|
25
|
+
transparency: theme.opacity[100],
|
|
26
|
+
dark: {
|
|
27
|
+
offset: -100
|
|
28
|
+
},
|
|
29
|
+
theme
|
|
30
|
+
});
|
|
31
|
+
const hoveredBorderColor = getColor({
|
|
32
|
+
variable: 'border.primaryEmphasis',
|
|
33
|
+
transparency: theme.opacity[200],
|
|
34
|
+
dark: {
|
|
35
|
+
offset: -100
|
|
36
|
+
},
|
|
37
|
+
theme
|
|
38
|
+
});
|
|
39
|
+
const selectedBackgroundColor = getColor({
|
|
40
|
+
variable: 'background.primaryEmphasis',
|
|
41
|
+
transparency: theme.opacity[200],
|
|
42
|
+
dark: {
|
|
43
|
+
offset: -100
|
|
44
|
+
},
|
|
45
|
+
theme
|
|
46
|
+
});
|
|
47
|
+
const selectedBorderColor = getColor({
|
|
48
|
+
variable: 'border.primaryEmphasis',
|
|
49
|
+
light: {
|
|
50
|
+
offset: -400
|
|
51
|
+
},
|
|
52
|
+
dark: {
|
|
53
|
+
offset: 300
|
|
54
|
+
},
|
|
55
|
+
theme
|
|
56
|
+
});
|
|
57
|
+
const hoveredSelectedBackgroundColor = getColor({
|
|
58
|
+
variable: 'background.primaryEmphasis',
|
|
59
|
+
transparency: theme.opacity[300],
|
|
60
|
+
dark: {
|
|
61
|
+
offset: -100
|
|
62
|
+
},
|
|
63
|
+
theme
|
|
64
|
+
});
|
|
65
|
+
const boxShadowColor = getColor({
|
|
66
|
+
variable: 'border.primaryEmphasis',
|
|
67
|
+
theme
|
|
68
|
+
});
|
|
69
|
+
const boxShadow = `inset ${theme.rtl ? '-' : ''}${theme.shadowWidths.md} 0 0 0 ${boxShadowColor}`;
|
|
70
|
+
let backgroundColor = undefined;
|
|
71
|
+
let borderColor = undefined;
|
|
72
|
+
let hoverBorderBottomColor = undefined;
|
|
73
|
+
let hoverBackgroundColor = undefined;
|
|
74
|
+
if ($isSelected) {
|
|
75
|
+
if ($isHovered) {
|
|
76
|
+
backgroundColor = hoveredSelectedBackgroundColor;
|
|
77
|
+
} else {
|
|
78
|
+
backgroundColor = selectedBackgroundColor;
|
|
79
|
+
}
|
|
80
|
+
borderColor = selectedBorderColor;
|
|
81
|
+
hoverBorderBottomColor = selectedBorderColor;
|
|
82
|
+
hoverBackgroundColor = hoveredSelectedBackgroundColor;
|
|
83
|
+
} else if ($isHovered) {
|
|
84
|
+
backgroundColor = hoveredBackgroundColor;
|
|
85
|
+
borderColor = hoveredBorderColor;
|
|
86
|
+
} else if (!$isReadOnly) {
|
|
87
|
+
hoverBorderBottomColor = hoveredBorderColor;
|
|
88
|
+
hoverBackgroundColor = hoveredBackgroundColor;
|
|
89
|
+
}
|
|
90
|
+
return css(["border-bottom-color:", ";background-color:", ";&:hover{border-bottom-color:", ";background-color:", ";", "{opacity:1;}}&:focus{outline:none;}", ":first-of-type{box-shadow:", ";&:focus{box-shadow:", ";}}"], borderColor, backgroundColor, hoverBorderBottomColor, hoverBackgroundColor, StyledOverflowButton, StyledCell, $isFocused && boxShadow, boxShadow);
|
|
91
|
+
};
|
|
92
|
+
const sizeStyles = props => {
|
|
93
|
+
return css(["height:", ";"], getRowHeight(props));
|
|
94
|
+
};
|
|
95
|
+
const StyledRow = styled(StyledBaseRow).attrs({
|
|
96
|
+
'data-garden-id': COMPONENT_ID,
|
|
97
|
+
'data-garden-version': '9.0.0-next.21'
|
|
98
|
+
}).withConfig({
|
|
99
|
+
displayName: "StyledRow",
|
|
100
|
+
componentId: "sc-ek66ow-0"
|
|
101
|
+
})(["", " ", " ", ";"], sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
102
|
+
StyledRow.defaultProps = {
|
|
103
|
+
theme: DEFAULT_THEME
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export { StyledRow };
|
|
@@ -0,0 +1,104 @@
|
|
|
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 { math } from 'polished';
|
|
9
|
+
import { DEFAULT_THEME, SELECTOR_FOCUS_VISIBLE, retrieveComponentStyles, getColor, focusStyles } from '@zendeskgarden/react-theming';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'tables.sortable';
|
|
12
|
+
const StyledBaseIconWrapper = styled.div.withConfig({
|
|
13
|
+
displayName: "StyledSortableButton__StyledBaseIconWrapper",
|
|
14
|
+
componentId: "sc-2s1dli-0"
|
|
15
|
+
})(["display:flex;position:absolute;top:0;", ":0;align-items:center;justify-content:center;opacity:0;width:", ";height:100%;color:inherit;fill:inherit;"], props => props.theme.rtl ? 'left' : 'right', props => props.theme.iconSizes.sm);
|
|
16
|
+
StyledBaseIconWrapper.defaultProps = {
|
|
17
|
+
theme: DEFAULT_THEME
|
|
18
|
+
};
|
|
19
|
+
const StyledSortableStrokeIconWrapper = styled(StyledBaseIconWrapper).withConfig({
|
|
20
|
+
displayName: "StyledSortableButton__StyledSortableStrokeIconWrapper",
|
|
21
|
+
componentId: "sc-2s1dli-1"
|
|
22
|
+
})([""]);
|
|
23
|
+
StyledSortableStrokeIconWrapper.defaultProps = {
|
|
24
|
+
theme: DEFAULT_THEME
|
|
25
|
+
};
|
|
26
|
+
const StyledSortableFillIconWrapper = styled(StyledBaseIconWrapper).withConfig({
|
|
27
|
+
displayName: "StyledSortableButton__StyledSortableFillIconWrapper",
|
|
28
|
+
componentId: "sc-2s1dli-2"
|
|
29
|
+
})([""]);
|
|
30
|
+
StyledSortableFillIconWrapper.defaultProps = {
|
|
31
|
+
theme: DEFAULT_THEME
|
|
32
|
+
};
|
|
33
|
+
const colorStyles = _ref => {
|
|
34
|
+
let {
|
|
35
|
+
theme,
|
|
36
|
+
$sort
|
|
37
|
+
} = _ref;
|
|
38
|
+
const fgInactive = getColor({
|
|
39
|
+
variable: 'foreground.subtle',
|
|
40
|
+
transparency: theme.opacity[200],
|
|
41
|
+
theme
|
|
42
|
+
});
|
|
43
|
+
const fgActive = getColor({
|
|
44
|
+
variable: 'foreground.subtle',
|
|
45
|
+
theme
|
|
46
|
+
});
|
|
47
|
+
const fgPrimaryActive = getColor({
|
|
48
|
+
variable: 'foreground.primary',
|
|
49
|
+
theme
|
|
50
|
+
});
|
|
51
|
+
const fgPrimaryInactive = getColor({
|
|
52
|
+
variable: 'foreground.primary',
|
|
53
|
+
theme,
|
|
54
|
+
dark: {
|
|
55
|
+
offset: -100
|
|
56
|
+
},
|
|
57
|
+
transparency: theme.opacity[200]
|
|
58
|
+
});
|
|
59
|
+
let color = fgActive;
|
|
60
|
+
let fill = fgActive;
|
|
61
|
+
if ($sort === 'asc') {
|
|
62
|
+
color = fgActive;
|
|
63
|
+
fill = fgInactive;
|
|
64
|
+
} else if ($sort === 'desc') {
|
|
65
|
+
color = fgInactive;
|
|
66
|
+
fill = fgActive;
|
|
67
|
+
}
|
|
68
|
+
return css(["", "{color:", ";fill:", ";}", "{color:", ";fill:", ";}&:hover,", "{color:", ";", ";", " ", "}", ""], StyledSortableStrokeIconWrapper, fgActive, fgActive, StyledSortableFillIconWrapper, color, fill, SELECTOR_FOCUS_VISIBLE, fgPrimaryActive, $sort === undefined && `
|
|
69
|
+
${StyledSortableFillIconWrapper} {
|
|
70
|
+
opacity: 1;
|
|
71
|
+
color: ${fgPrimaryActive};
|
|
72
|
+
fill: ${fgPrimaryActive};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
${StyledSortableStrokeIconWrapper} {
|
|
76
|
+
opacity: 0;
|
|
77
|
+
}
|
|
78
|
+
`, $sort === 'asc' && `
|
|
79
|
+
${StyledSortableFillIconWrapper} {
|
|
80
|
+
color: ${fgPrimaryActive};
|
|
81
|
+
fill: ${fgPrimaryInactive};
|
|
82
|
+
}
|
|
83
|
+
`, $sort === 'desc' && `
|
|
84
|
+
${StyledSortableFillIconWrapper} {
|
|
85
|
+
color: ${fgPrimaryInactive};
|
|
86
|
+
fill: ${fgPrimaryActive};
|
|
87
|
+
}
|
|
88
|
+
`, focusStyles({
|
|
89
|
+
theme
|
|
90
|
+
}));
|
|
91
|
+
};
|
|
92
|
+
const StyledSortableButton = styled.button.attrs({
|
|
93
|
+
'data-garden-id': COMPONENT_ID,
|
|
94
|
+
'data-garden-version': '9.0.0-next.21',
|
|
95
|
+
type: 'button'
|
|
96
|
+
}).withConfig({
|
|
97
|
+
displayName: "StyledSortableButton",
|
|
98
|
+
componentId: "sc-2s1dli-3"
|
|
99
|
+
})(["position:relative;transition:box-shadow 0.1s ease-in-out;border:none;border-radius:", ";background-color:transparent;cursor:pointer;padding:0;padding-", ":", ";width:", ";text-decoration:none;color:inherit;font-family:inherit;font-size:inherit;font-weight:", ";", "{opacity:", ";}", "{opacity:", ";}&:hover,", "{text-decoration:none;}", " ", ";"], props => props.theme.borderRadii.sm, props => props.theme.rtl ? 'left' : 'right', props => math(`${props.theme.space.base} + ${props.theme.iconSizes.sm}`), props => props.width, props => props.theme.fontWeights.semibold, StyledSortableStrokeIconWrapper, props => props.$sort === undefined && 1, StyledSortableFillIconWrapper, props => props.$sort !== undefined && 1, SELECTOR_FOCUS_VISIBLE, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
100
|
+
StyledSortableButton.defaultProps = {
|
|
101
|
+
theme: DEFAULT_THEME
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export { StyledSortableButton, StyledSortableFillIconWrapper, StyledSortableStrokeIconWrapper };
|
|
@@ -0,0 +1,28 @@
|
|
|
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 from 'styled-components';
|
|
8
|
+
import { getColor, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const COMPONENT_ID = 'tables.table';
|
|
11
|
+
const getLineHeight = props => {
|
|
12
|
+
return `${props.theme.space.base * 5}px`;
|
|
13
|
+
};
|
|
14
|
+
const StyledTable = styled.table.attrs({
|
|
15
|
+
'data-garden-id': COMPONENT_ID,
|
|
16
|
+
'data-garden-version': '9.0.0-next.21'
|
|
17
|
+
}).withConfig({
|
|
18
|
+
displayName: "StyledTable",
|
|
19
|
+
componentId: "sc-gje7na-0"
|
|
20
|
+
})(["display:table;border:none;width:100%;table-layout:fixed;border-collapse:collapse;border-spacing:0;line-height:", ";color:", ";font-size:", ";direction:", ";", ";"], props => getLineHeight(props), props => getColor({
|
|
21
|
+
variable: 'foreground.default',
|
|
22
|
+
theme: props.theme
|
|
23
|
+
}), props => props.theme.fontSizes.md, props => props.theme.rtl && 'rtl', props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
24
|
+
StyledTable.defaultProps = {
|
|
25
|
+
theme: DEFAULT_THEME
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { StyledTable, getLineHeight };
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
const getRowHeight = props => {
|
|
8
|
+
if (props.$size === 'large') {
|
|
9
|
+
return `${props.theme.space.base * 16}px`;
|
|
10
|
+
} else if (props.$size === 'small') {
|
|
11
|
+
return `${props.theme.space.base * 8}px`;
|
|
12
|
+
}
|
|
13
|
+
return `${props.theme.space.base * 10}px`;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { getRowHeight };
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
const SIZE = ['small', 'medium', 'large'];
|
|
8
|
+
const SORT = ['asc', 'desc'];
|
|
9
|
+
|
|
10
|
+
export { SIZE, SORT };
|
|
@@ -0,0 +1,17 @@
|
|
|
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 React__default, { useContext } from 'react';
|
|
8
|
+
|
|
9
|
+
const TableContext = React__default.createContext({
|
|
10
|
+
size: 'medium',
|
|
11
|
+
isReadOnly: false
|
|
12
|
+
});
|
|
13
|
+
const useTableContext = () => {
|
|
14
|
+
return useContext(TableContext);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { TableContext, useTableContext };
|