@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.
Files changed (41) hide show
  1. package/dist/esm/elements/Cell.js +7 -1
  2. package/dist/esm/elements/GroupRow.js +1 -1
  3. package/dist/esm/elements/Head.js +10 -3
  4. package/dist/esm/elements/HeaderCell.js +7 -1
  5. package/dist/esm/elements/HeaderRow.js +1 -1
  6. package/dist/esm/elements/OverflowButton.js +9 -27
  7. package/dist/esm/elements/Row.js +13 -5
  8. package/dist/esm/elements/SortableCell.js +13 -5
  9. package/dist/esm/elements/Table.js +9 -4
  10. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/sort-fill.svg.js +1 -1
  11. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/sort-stroke.svg.js +1 -1
  12. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/overflow-vertical-stroke.svg.js +25 -0
  13. package/dist/esm/styled/StyledBaseRow.js +46 -0
  14. package/dist/esm/styled/StyledBody.js +1 -1
  15. package/dist/esm/styled/StyledCaption.js +1 -1
  16. package/dist/esm/styled/StyledCell.js +4 -4
  17. package/dist/esm/styled/StyledGroupRow.js +20 -4
  18. package/dist/esm/styled/StyledHead.js +19 -6
  19. package/dist/esm/styled/StyledHeaderCell.js +4 -4
  20. package/dist/esm/styled/StyledHeaderRow.js +20 -7
  21. package/dist/esm/styled/StyledHiddenCell.js +1 -1
  22. package/dist/esm/styled/StyledOverflowButton.js +7 -32
  23. package/dist/esm/styled/StyledRow.js +71 -27
  24. package/dist/esm/styled/StyledSortableButton.js +63 -40
  25. package/dist/esm/styled/StyledTable.js +6 -3
  26. package/dist/esm/styled/style-utils.js +2 -2
  27. package/dist/index.cjs.js +398 -263
  28. package/dist/typings/elements/OverflowButton.d.ts +2 -10
  29. package/dist/typings/styled/StyledBaseRow.d.ts +11 -0
  30. package/dist/typings/styled/StyledCell.d.ts +5 -2
  31. package/dist/typings/styled/StyledGroupRow.d.ts +7 -3
  32. package/dist/typings/styled/StyledHead.d.ts +1 -1
  33. package/dist/typings/styled/StyledHeaderRow.d.ts +7 -3
  34. package/dist/typings/styled/StyledOverflowButton.d.ts +7 -9
  35. package/dist/typings/styled/StyledRow.d.ts +10 -8
  36. package/dist/typings/styled/StyledSortableButton.d.ts +5 -4
  37. package/dist/typings/styled/StyledTable.d.ts +4 -6
  38. package/dist/typings/styled/index.d.ts +1 -1
  39. package/dist/typings/styled/style-utils.d.ts +1 -1
  40. package/package.json +6 -5
  41. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/overflow-stroke.svg.js +0 -36
@@ -5,32 +5,74 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import styled, { css } from 'styled-components';
8
- import { getColorV8, DEFAULT_THEME, retrieveComponentStyles } from '@zendeskgarden/react-theming';
8
+ import { retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
9
9
  import { StyledCell } from './StyledCell.js';
10
+ import { StyledBaseRow } from './StyledBaseRow.js';
10
11
  import { StyledOverflowButton } from './StyledOverflowButton.js';
11
12
  import { getRowHeight } from './style-utils.js';
12
13
 
13
14
  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);
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}`;
28
70
  let backgroundColor = undefined;
29
71
  let borderColor = undefined;
30
72
  let hoverBorderBottomColor = undefined;
31
73
  let hoverBackgroundColor = undefined;
32
- if (props.isSelected) {
33
- if (props.isHovered) {
74
+ if ($isSelected) {
75
+ if ($isHovered) {
34
76
  backgroundColor = hoveredSelectedBackgroundColor;
35
77
  } else {
36
78
  backgroundColor = selectedBackgroundColor;
@@ -38,25 +80,27 @@ const colorStyles = props => {
38
80
  borderColor = selectedBorderColor;
39
81
  hoverBorderBottomColor = selectedBorderColor;
40
82
  hoverBackgroundColor = hoveredSelectedBackgroundColor;
41
- } else if (props.isHovered) {
83
+ } else if ($isHovered) {
42
84
  backgroundColor = hoveredBackgroundColor;
43
85
  borderColor = hoveredBorderColor;
44
- } else if (!props.isReadOnly) {
86
+ } else if (!$isReadOnly) {
45
87
  hoverBorderBottomColor = hoveredBorderColor;
46
88
  hoverBackgroundColor = hoveredBackgroundColor;
47
89
  }
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);
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);
49
91
  };
50
- const StyledRow = styled(StyledBaseRow).attrs(props => ({
92
+ const sizeStyles = props => {
93
+ return css(["height:", ";"], getRowHeight(props));
94
+ };
95
+ const StyledRow = styled(StyledBaseRow).attrs({
51
96
  'data-garden-id': COMPONENT_ID,
52
- 'data-garden-version': '9.0.0-next.12',
53
- tabIndex: props.isReadOnly ? undefined : -1
54
- })).withConfig({
97
+ 'data-garden-version': '9.0.0-next.14'
98
+ }).withConfig({
55
99
  displayName: "StyledRow",
56
- componentId: "sc-ek66ow-1"
57
- })(["height:", ";", " ", ";"], getRowHeight, props => colorStyles(props), props => retrieveComponentStyles(COMPONENT_ID, props));
100
+ componentId: "sc-ek66ow-0"
101
+ })(["", " ", " ", ";"], sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
58
102
  StyledRow.defaultProps = {
59
103
  theme: DEFAULT_THEME
60
104
  };
61
105
 
62
- export { StyledBaseRow, StyledRow };
106
+ export { StyledRow };
@@ -4,9 +4,9 @@
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 { DEFAULT_THEME, getColorV8, SELECTOR_FOCUS_VISIBLE, focusStyles, retrieveComponentStyles } from '@zendeskgarden/react-theming';
9
+ import { DEFAULT_THEME, SELECTOR_FOCUS_VISIBLE, retrieveComponentStyles, getColor, focusStyles } from '@zendeskgarden/react-theming';
10
10
 
11
11
  const COMPONENT_ID = 'tables.sortable';
12
12
  const StyledBaseIconWrapper = styled.div.withConfig({
@@ -30,50 +30,73 @@ const StyledSortableFillIconWrapper = styled(StyledBaseIconWrapper).withConfig({
30
30
  StyledSortableFillIconWrapper.defaultProps = {
31
31
  theme: DEFAULT_THEME
32
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
+ };
33
92
  const StyledSortableButton = styled.button.attrs({
34
93
  'data-garden-id': COMPONENT_ID,
35
- 'data-garden-version': '9.0.0-next.12',
94
+ 'data-garden-version': '9.0.0-next.14',
36
95
  type: 'button'
37
96
  }).withConfig({
38
97
  displayName: "StyledSortableButton",
39
98
  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));
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));
77
100
  StyledSortableButton.defaultProps = {
78
101
  theme: DEFAULT_THEME
79
102
  };
@@ -5,7 +5,7 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import styled from 'styled-components';
8
- import { getColorV8, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
8
+ import { getColor, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
9
 
10
10
  const COMPONENT_ID = 'tables.table';
11
11
  const getLineHeight = props => {
@@ -13,11 +13,14 @@ const getLineHeight = props => {
13
13
  };
14
14
  const StyledTable = styled.table.attrs({
15
15
  'data-garden-id': COMPONENT_ID,
16
- 'data-garden-version': '9.0.0-next.12'
16
+ 'data-garden-version': '9.0.0-next.14'
17
17
  }).withConfig({
18
18
  displayName: "StyledTable",
19
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));
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));
21
24
  StyledTable.defaultProps = {
22
25
  theme: DEFAULT_THEME
23
26
  };
@@ -5,9 +5,9 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  const getRowHeight = props => {
8
- if (props.size === 'large') {
8
+ if (props.$size === 'large') {
9
9
  return `${props.theme.space.base * 16}px`;
10
- } else if (props.size === 'small') {
10
+ } else if (props.$size === 'small') {
11
11
  return `${props.theme.space.base * 8}px`;
12
12
  }
13
13
  return `${props.theme.space.base * 10}px`;