@zendeskgarden/react-tables 9.0.0-next.7 → 9.0.0-next.8

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.
Files changed (33) hide show
  1. package/dist/esm/elements/Body.js +26 -0
  2. package/dist/esm/elements/Caption.js +26 -0
  3. package/dist/esm/elements/Cell.js +44 -0
  4. package/dist/esm/elements/GroupRow.js +33 -0
  5. package/dist/esm/elements/Head.js +26 -0
  6. package/dist/esm/elements/HeaderCell.js +39 -0
  7. package/dist/esm/elements/HeaderRow.js +33 -0
  8. package/dist/esm/elements/OverflowButton.js +55 -0
  9. package/dist/esm/elements/Row.js +68 -0
  10. package/dist/esm/elements/SortableCell.js +55 -0
  11. package/dist/esm/elements/Table.js +65 -0
  12. package/dist/esm/index.js +17 -0
  13. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/sort-fill.svg.js +27 -0
  14. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/sort-stroke.svg.js +27 -0
  15. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/overflow-stroke.svg.js +36 -0
  16. package/dist/esm/styled/StyledBody.js +22 -0
  17. package/dist/esm/styled/StyledCaption.js +22 -0
  18. package/dist/esm/styled/StyledCell.js +47 -0
  19. package/dist/esm/styled/StyledGroupRow.js +31 -0
  20. package/dist/esm/styled/StyledHead.js +27 -0
  21. package/dist/esm/styled/StyledHeaderCell.js +44 -0
  22. package/dist/esm/styled/StyledHeaderRow.js +33 -0
  23. package/dist/esm/styled/StyledHiddenCell.js +23 -0
  24. package/dist/esm/styled/StyledOverflowButton.js +51 -0
  25. package/dist/esm/styled/StyledRow.js +62 -0
  26. package/dist/esm/styled/StyledSortableButton.js +81 -0
  27. package/dist/esm/styled/StyledTable.js +25 -0
  28. package/dist/esm/styled/style-utils.js +16 -0
  29. package/dist/esm/types/index.js +10 -0
  30. package/dist/esm/utils/useTableContext.js +17 -0
  31. package/dist/index.cjs.js +29 -45
  32. package/package.json +5 -5
  33. package/dist/index.esm.js +0 -648
@@ -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.8'
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,31 @@
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 { getColorV8, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
10
+ import { StyledBaseRow } from './StyledRow.js';
11
+ import { StyledCell } from './StyledCell.js';
12
+ import { getLineHeight } from './StyledTable.js';
13
+
14
+ const COMPONENT_ID = 'tables.group_row';
15
+ const sizeStyles = props => {
16
+ const height = `${props.theme.space.base * 8}px`;
17
+ const lineHeight = getLineHeight(props);
18
+ 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);
19
+ };
20
+ const StyledGroupRow = styled(StyledBaseRow).attrs({
21
+ 'data-garden-id': COMPONENT_ID,
22
+ 'data-garden-version': '9.0.0-next.8'
23
+ }).withConfig({
24
+ displayName: "StyledGroupRow",
25
+ componentId: "sc-mpd0r8-0"
26
+ })(["background-color:", ";", " ", ";"], props => getColorV8('neutralHue', 100, props.theme), props => sizeStyles(props), props => retrieveComponentStyles(COMPONENT_ID, props));
27
+ StyledGroupRow.defaultProps = {
28
+ theme: DEFAULT_THEME
29
+ };
30
+
31
+ export { StyledGroupRow };
@@ -0,0 +1,27 @@
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, getColorV8 } from '@zendeskgarden/react-theming';
9
+ import { StyledHeaderRow } from './StyledHeaderRow.js';
10
+
11
+ const COMPONENT_ID = 'tables.head';
12
+ const stickyStyles = props => {
13
+ const borderColor = getColorV8('neutralHue', 300, props.theme);
14
+ return css(["position:sticky;top:0;z-index:1;box-shadow:inset 0 -", " 0 ", ";background-color:", ";& > ", ":last-child{border-bottom-color:transparent;}"], props.theme.borderWidths.sm, borderColor, getColorV8('background', 600 , props.theme), StyledHeaderRow);
15
+ };
16
+ const StyledHead = styled.thead.attrs({
17
+ 'data-garden-id': COMPONENT_ID,
18
+ 'data-garden-version': '9.0.0-next.8'
19
+ }).withConfig({
20
+ displayName: "StyledHead",
21
+ componentId: "sc-spf23a-0"
22
+ })(["", " ", ";"], props => props.isSticky && stickyStyles(props), props => retrieveComponentStyles(COMPONENT_ID, props));
23
+ StyledHead.defaultProps = {
24
+ theme: DEFAULT_THEME
25
+ };
26
+
27
+ 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.8'
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,33 @@
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 { getColorV8, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
10
+ import { StyledBaseRow } from './StyledRow.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 StyledHeaderRow = styled(StyledBaseRow).attrs({
23
+ 'data-garden-id': COMPONENT_ID,
24
+ 'data-garden-version': '9.0.0-next.8'
25
+ }).withConfig({
26
+ displayName: "StyledHeaderRow",
27
+ componentId: "sc-16ogvdx-0"
28
+ })(["border-bottom-color:", ";height:", ";vertical-align:bottom;font-weight:", ";", "{opacity:1;margin-top:0;margin-bottom:calc(", " - 1em);}", ";"], props => getColorV8('neutralHue', 300, props.theme), getHeaderRowHeight, props => props.theme.fontWeights.semibold, StyledOverflowButton, props => math(`${getHeaderRowHeight(props)} / 2`), props => retrieveComponentStyles(COMPONENT_ID, props));
29
+ StyledHeaderRow.defaultProps = {
30
+ theme: DEFAULT_THEME
31
+ };
32
+
33
+ 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.8'
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,51 @@
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, getColorV8, focusStyles } from '@zendeskgarden/react-theming';
10
+ import { getRowHeight } from './style-utils.js';
11
+
12
+ const COMPONENT_ID = 'tables.overflow_button';
13
+ const OVERFLOW_BUTTON_SIZE = '2em';
14
+ const colorStyles = props => {
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({
33
+ 'data-garden-id': COMPONENT_ID,
34
+ 'data-garden-version': '9.0.0-next.8',
35
+ type: 'button'
36
+ }).withConfig({
37
+ displayName: "StyledOverflowButton",
38
+ componentId: "sc-1eba2ml-0"
39
+ })(["display:block;transition:background-color 0.1s ease-in-out,box-shadow 0.1s ease-in-out;z-index:", ";margin-top:calc(", " - 1em);border:none;border-radius:50%;background-color:transparent;cursor:pointer;padding:0;width:100%;height:", ";text-decoration:none;font-size:inherit;", " ", ";"], props => props.isActive ? '1' : '0', props => math(`${getRowHeight(props)} / 2`), OVERFLOW_BUTTON_SIZE, props => colorStyles(props), props => retrieveComponentStyles(COMPONENT_ID, props));
40
+ StyledOverflowButton.defaultProps = {
41
+ theme: DEFAULT_THEME
42
+ };
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
+
51
+ export { StyledOverflowButton, StyledOverflowButtonIconWrapper };
@@ -0,0 +1,62 @@
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 { getColorV8, DEFAULT_THEME, retrieveComponentStyles } from '@zendeskgarden/react-theming';
9
+ import { StyledCell } from './StyledCell.js';
10
+ import { StyledOverflowButton } from './StyledOverflowButton.js';
11
+ import { getRowHeight } from './style-utils.js';
12
+
13
+ const COMPONENT_ID = 'tables.row';
14
+ const StyledBaseRow = styled.tr.withConfig({
15
+ displayName: "StyledRow__StyledBaseRow",
16
+ componentId: "sc-ek66ow-0"
17
+ })(["display:table-row;transition:background-color 0.1s ease-in-out;border-bottom:", ";background-color:", ";vertical-align:top;box-sizing:border-box;"], props => `${props.theme.borders.sm} ${getColorV8('neutralHue', 200, props.theme)}`, props => props.isStriped && getColorV8('neutralHue', 100, props.theme));
18
+ StyledBaseRow.defaultProps = {
19
+ theme: DEFAULT_THEME
20
+ };
21
+ const colorStyles = props => {
22
+ const boxShadow = `inset ${props.theme.rtl ? '-' : ''}${props.theme.shadowWidths.md} 0 0 0 ${getColorV8('primaryHue', 600, props.theme)}`;
23
+ const hoveredBackgroundColor = getColorV8('primaryHue', 600, props.theme, 0.08);
24
+ const hoveredBorderColor = getColorV8('primaryHue', 200, props.theme);
25
+ const selectedBackgroundColor = getColorV8('primaryHue', 600, props.theme, 0.2);
26
+ const selectedBorderColor = getColorV8('primaryHue', 300, props.theme);
27
+ const hoveredSelectedBackgroundColor = getColorV8('primaryHue', 600, props.theme, 0.28);
28
+ let backgroundColor = undefined;
29
+ let borderColor = undefined;
30
+ let hoverBorderBottomColor = undefined;
31
+ let hoverBackgroundColor = undefined;
32
+ if (props.isSelected) {
33
+ if (props.isHovered) {
34
+ backgroundColor = hoveredSelectedBackgroundColor;
35
+ } else {
36
+ backgroundColor = selectedBackgroundColor;
37
+ }
38
+ borderColor = selectedBorderColor;
39
+ hoverBorderBottomColor = selectedBorderColor;
40
+ hoverBackgroundColor = hoveredSelectedBackgroundColor;
41
+ } else if (props.isHovered) {
42
+ backgroundColor = hoveredBackgroundColor;
43
+ borderColor = hoveredBorderColor;
44
+ } else if (!props.isReadOnly) {
45
+ hoverBorderBottomColor = hoveredBorderColor;
46
+ hoverBackgroundColor = hoveredBackgroundColor;
47
+ }
48
+ 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, props.isFocused && boxShadow, boxShadow);
49
+ };
50
+ const StyledRow = styled(StyledBaseRow).attrs(props => ({
51
+ 'data-garden-id': COMPONENT_ID,
52
+ 'data-garden-version': '9.0.0-next.8',
53
+ tabIndex: props.isReadOnly ? undefined : -1
54
+ })).withConfig({
55
+ displayName: "StyledRow",
56
+ componentId: "sc-ek66ow-1"
57
+ })(["height:", ";", " ", ";"], getRowHeight, props => colorStyles(props), props => retrieveComponentStyles(COMPONENT_ID, props));
58
+ StyledRow.defaultProps = {
59
+ theme: DEFAULT_THEME
60
+ };
61
+
62
+ export { StyledBaseRow, StyledRow };
@@ -0,0 +1,81 @@
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 { DEFAULT_THEME, getColorV8, SELECTOR_FOCUS_VISIBLE, focusStyles, retrieveComponentStyles } 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 StyledSortableButton = styled.button.attrs({
34
+ 'data-garden-id': COMPONENT_ID,
35
+ 'data-garden-version': '9.0.0-next.8',
36
+ type: 'button'
37
+ }).withConfig({
38
+ displayName: "StyledSortableButton",
39
+ componentId: "sc-2s1dli-3"
40
+ })(["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:", ";color:", ";fill:", ";}&:hover,", "{text-decoration:none;color:", ";", ";", " ", "}", " ", ";"], 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, props => {
41
+ if (props.sort === 'asc') {
42
+ return getColorV8('neutralHue', 600, props.theme);
43
+ } else if (props.sort === 'desc') {
44
+ return getColorV8('neutralHue', 400, props.theme);
45
+ }
46
+ return undefined;
47
+ }, props => {
48
+ if (props.sort === 'asc') {
49
+ return getColorV8('neutralHue', 400, props.theme);
50
+ } else if (props.sort === 'desc') {
51
+ return getColorV8('neutralHue', 600, props.theme);
52
+ }
53
+ return undefined;
54
+ }, SELECTOR_FOCUS_VISIBLE, props => getColorV8('primaryHue', 600, props.theme), props => props.sort === undefined && `
55
+ ${StyledSortableFillIconWrapper} {
56
+ opacity: 1;
57
+ color: ${getColorV8('primaryHue', 600, props.theme)};
58
+ fill: ${getColorV8('primaryHue', 600, props.theme)};
59
+ }
60
+
61
+ ${StyledSortableStrokeIconWrapper} {
62
+ opacity: 0;
63
+ }
64
+ `, props => props.sort === 'asc' && `
65
+ ${StyledSortableFillIconWrapper} {
66
+ color: ${getColorV8('primaryHue', 600, props.theme)};
67
+ fill: ${getColorV8('primaryHue', 600, props.theme, 0.25)};
68
+ }
69
+ `, props => props.sort === 'desc' && `
70
+ ${StyledSortableFillIconWrapper} {
71
+ color: ${getColorV8('primaryHue', 600, props.theme, 0.25)};
72
+ fill: ${getColorV8('primaryHue', 600, props.theme)};
73
+ }
74
+ `, props => focusStyles({
75
+ theme: props.theme
76
+ }), props => retrieveComponentStyles(COMPONENT_ID, props));
77
+ StyledSortableButton.defaultProps = {
78
+ theme: DEFAULT_THEME
79
+ };
80
+
81
+ export { StyledSortableButton, StyledSortableFillIconWrapper, StyledSortableStrokeIconWrapper };
@@ -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 styled from 'styled-components';
8
+ import { getColorV8, 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.8'
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 => getColorV8('foreground', 600 , props.theme), props => props.theme.fontSizes.md, props => props.theme.rtl && 'rtl', props => retrieveComponentStyles(COMPONENT_ID, props));
21
+ StyledTable.defaultProps = {
22
+ theme: DEFAULT_THEME
23
+ };
24
+
25
+ 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 };