@instructure/ui-table 11.7.3-snapshot-7 → 11.7.3-snapshot-26

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 (65) hide show
  1. package/CHANGELOG.md +5 -2
  2. package/es/Table/v1/Body/index.js +21 -15
  3. package/es/Table/v1/Body/theme.js +9 -8
  4. package/es/Table/v1/Cell/index.js +20 -16
  5. package/es/Table/v1/Cell/styles.js +3 -1
  6. package/es/Table/v1/Cell/theme.js +13 -12
  7. package/es/Table/v1/ColHeader/index.js +43 -41
  8. package/es/Table/v1/ColHeader/styles.js +4 -2
  9. package/es/Table/v1/ColHeader/theme.js +19 -18
  10. package/es/Table/v1/Head/index.js +34 -34
  11. package/es/Table/v1/Head/theme.js +9 -8
  12. package/es/Table/v1/Row/index.js +18 -14
  13. package/es/Table/v1/Row/styles.js +4 -2
  14. package/es/Table/v1/Row/theme.js +14 -13
  15. package/es/Table/v1/RowHeader/index.js +19 -15
  16. package/es/Table/v1/RowHeader/styles.js +3 -1
  17. package/es/Table/v1/RowHeader/theme.js +13 -12
  18. package/es/Table/v1/index.js +50 -55
  19. package/es/Table/v1/styles.js +3 -1
  20. package/es/Table/v1/theme.js +10 -9
  21. package/es/Table/v2/Body/index.js +21 -15
  22. package/es/Table/v2/Cell/index.js +20 -16
  23. package/es/Table/v2/Cell/styles.js +3 -1
  24. package/es/Table/v2/ColHeader/index.js +45 -43
  25. package/es/Table/v2/ColHeader/styles.js +4 -2
  26. package/es/Table/v2/Head/index.js +37 -37
  27. package/es/Table/v2/Row/index.js +18 -14
  28. package/es/Table/v2/Row/styles.js +4 -2
  29. package/es/Table/v2/RowHeader/index.js +19 -15
  30. package/es/Table/v2/RowHeader/styles.js +3 -1
  31. package/es/Table/v2/index.js +50 -55
  32. package/es/Table/v2/styles.js +3 -1
  33. package/lib/Table/v1/Body/index.js +21 -15
  34. package/lib/Table/v1/Body/theme.js +9 -8
  35. package/lib/Table/v1/Cell/index.js +20 -16
  36. package/lib/Table/v1/Cell/styles.js +3 -1
  37. package/lib/Table/v1/Cell/theme.js +13 -12
  38. package/lib/Table/v1/ColHeader/index.js +43 -41
  39. package/lib/Table/v1/ColHeader/styles.js +4 -2
  40. package/lib/Table/v1/ColHeader/theme.js +19 -18
  41. package/lib/Table/v1/Head/index.js +35 -35
  42. package/lib/Table/v1/Head/theme.js +9 -8
  43. package/lib/Table/v1/Row/index.js +18 -14
  44. package/lib/Table/v1/Row/styles.js +4 -2
  45. package/lib/Table/v1/Row/theme.js +14 -13
  46. package/lib/Table/v1/RowHeader/index.js +19 -15
  47. package/lib/Table/v1/RowHeader/styles.js +3 -1
  48. package/lib/Table/v1/RowHeader/theme.js +13 -12
  49. package/lib/Table/v1/index.js +50 -55
  50. package/lib/Table/v1/styles.js +3 -1
  51. package/lib/Table/v1/theme.js +10 -9
  52. package/lib/Table/v2/Body/index.js +21 -15
  53. package/lib/Table/v2/Cell/index.js +20 -16
  54. package/lib/Table/v2/Cell/styles.js +3 -1
  55. package/lib/Table/v2/ColHeader/index.js +45 -43
  56. package/lib/Table/v2/ColHeader/styles.js +4 -2
  57. package/lib/Table/v2/Head/index.js +38 -38
  58. package/lib/Table/v2/Row/index.js +18 -14
  59. package/lib/Table/v2/Row/styles.js +4 -2
  60. package/lib/Table/v2/RowHeader/index.js +19 -15
  61. package/lib/Table/v2/RowHeader/styles.js +3 -1
  62. package/lib/Table/v2/index.js +50 -55
  63. package/lib/Table/v2/styles.js +3 -1
  64. package/package.json +15 -15
  65. package/tsconfig.build.tsbuildinfo +1 -1
@@ -28,25 +28,26 @@
28
28
  * @return {Object} The final theme object with the overrides and component variables
29
29
  */
30
30
  const generateComponentTheme = theme => {
31
- var _colors$contrasts, _colors$contrasts2, _colors$contrasts3, _colors$contrasts4;
32
- const colors = theme.colors,
33
- typography = theme.typography,
34
- spacing = theme.spacing,
35
- themeName = theme.key;
31
+ const {
32
+ colors,
33
+ typography,
34
+ spacing,
35
+ key: themeName
36
+ } = theme;
36
37
  const themeSpecificStyle = {
37
38
  canvas: {
38
39
  hoverBorderColor: theme['ic-brand-primary']
39
40
  }
40
41
  };
41
42
  const componentVariables = {
42
- fontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeMedium,
43
- fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
44
- fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightNormal,
45
- color: colors === null || colors === void 0 ? void 0 : (_colors$contrasts = colors.contrasts) === null || _colors$contrasts === void 0 ? void 0 : _colors$contrasts.grey125125,
46
- background: colors === null || colors === void 0 ? void 0 : (_colors$contrasts2 = colors.contrasts) === null || _colors$contrasts2 === void 0 ? void 0 : _colors$contrasts2.white1010,
47
- borderColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts3 = colors.contrasts) === null || _colors$contrasts3 === void 0 ? void 0 : _colors$contrasts3.grey3045,
48
- hoverBorderColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts4 = colors.contrasts) === null || _colors$contrasts4 === void 0 ? void 0 : _colors$contrasts4.blue4570,
49
- padding: `${spacing === null || spacing === void 0 ? void 0 : spacing.xSmall} 0`
43
+ fontSize: typography?.fontSizeMedium,
44
+ fontFamily: typography?.fontFamily,
45
+ fontWeight: typography?.fontWeightNormal,
46
+ color: colors?.contrasts?.grey125125,
47
+ background: colors?.contrasts?.white1010,
48
+ borderColor: colors?.contrasts?.grey3045,
49
+ hoverBorderColor: colors?.contrasts?.blue4570,
50
+ padding: `${spacing?.xSmall} 0`
50
51
  };
51
52
  return {
52
53
  ...componentVariables,
@@ -1,4 +1,4 @@
1
- var _dec, _class, _RowHeader;
1
+ var _dec, _class;
2
2
  /*
3
3
  * The MIT License (MIT)
4
4
  *
@@ -38,32 +38,36 @@ id: Table.RowHeader
38
38
  ---
39
39
  **/
40
40
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
41
- let RowHeader = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_RowHeader = class RowHeader extends Component {
41
+ let RowHeader = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = class RowHeader extends Component {
42
+ static displayName = "RowHeader";
43
+ static componentId = 'Table.RowHeader';
44
+ static contextType = TableContext;
45
+ static allowedProps = allowedProps;
46
+ static defaultProps = {
47
+ textAlign: 'start',
48
+ children: null
49
+ };
42
50
  componentDidMount() {
43
- var _this$props$makeStyle, _this$props;
44
- (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
51
+ this.props.makeStyles?.();
45
52
  }
46
53
  componentDidUpdate() {
47
- var _this$props$makeStyle2, _this$props2;
48
- (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
54
+ this.props.makeStyles?.();
49
55
  }
50
56
  render() {
51
- const _this$props3 = this.props,
52
- children = _this$props3.children,
53
- styles = _this$props3.styles;
57
+ const {
58
+ children,
59
+ styles
60
+ } = this.props;
54
61
  const isStacked = this.context.isStacked;
55
62
  return _jsx(View, {
56
63
  ...View.omitViewProps(omitProps(this.props, RowHeader.allowedProps), RowHeader),
57
64
  as: isStacked ? 'div' : 'th',
58
- css: styles === null || styles === void 0 ? void 0 : styles.rowHeader,
65
+ css: styles?.rowHeader,
59
66
  scope: "row",
60
- role: isStacked ? 'rowheader' : void 0,
67
+ role: isStacked ? 'rowheader' : undefined,
61
68
  children: callRenderProp(children)
62
69
  });
63
70
  }
64
- }, _RowHeader.displayName = "RowHeader", _RowHeader.componentId = 'Table.RowHeader', _RowHeader.contextType = TableContext, _RowHeader.allowedProps = allowedProps, _RowHeader.defaultProps = {
65
- textAlign: 'start',
66
- children: null
67
- }, _RowHeader)) || _class);
71
+ }) || _class);
68
72
  export default RowHeader;
69
73
  export { RowHeader };
@@ -33,7 +33,9 @@
33
33
  * @return {Object} The final style object, which will be used in the component
34
34
  */
35
35
  const generateStyle = (componentTheme, props) => {
36
- const textAlign = props.textAlign;
36
+ const {
37
+ textAlign
38
+ } = props;
37
39
  return {
38
40
  rowHeader: {
39
41
  label: 'rowHeader',
@@ -28,19 +28,20 @@
28
28
  * @return {Object} The final theme object with the overrides and component variables
29
29
  */
30
30
  const generateComponentTheme = theme => {
31
- var _colors$contrasts, _colors$contrasts2, _colors$contrasts3;
32
- const colors = theme.colors,
33
- typography = theme.typography,
34
- spacing = theme.spacing;
31
+ const {
32
+ colors,
33
+ typography,
34
+ spacing
35
+ } = theme;
35
36
  const componentVariables = {
36
- fontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeMedium,
37
- fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
38
- fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightBold,
39
- color: colors === null || colors === void 0 ? void 0 : (_colors$contrasts = colors.contrasts) === null || _colors$contrasts === void 0 ? void 0 : _colors$contrasts.grey125125,
40
- background: colors === null || colors === void 0 ? void 0 : (_colors$contrasts2 = colors.contrasts) === null || _colors$contrasts2 === void 0 ? void 0 : _colors$contrasts2.white1010,
41
- borderColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts3 = colors.contrasts) === null || _colors$contrasts3 === void 0 ? void 0 : _colors$contrasts3.grey4570,
42
- lineHeight: typography === null || typography === void 0 ? void 0 : typography.lineHeightCondensed,
43
- padding: `${spacing === null || spacing === void 0 ? void 0 : spacing.xSmall} ${spacing === null || spacing === void 0 ? void 0 : spacing.small}`
37
+ fontSize: typography?.fontSizeMedium,
38
+ fontFamily: typography?.fontFamily,
39
+ fontWeight: typography?.fontWeightBold,
40
+ color: colors?.contrasts?.grey125125,
41
+ background: colors?.contrasts?.white1010,
42
+ borderColor: colors?.contrasts?.grey4570,
43
+ lineHeight: typography?.lineHeightCondensed,
44
+ padding: `${spacing?.xSmall} ${spacing?.small}`
44
45
  };
45
46
  return {
46
47
  ...componentVariables
@@ -1,5 +1,4 @@
1
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- var _dec, _class, _Table;
1
+ var _dec, _class;
3
2
  /*
4
3
  * The MIT License (MIT)
5
4
  *
@@ -47,34 +46,42 @@ category: components
47
46
  ---
48
47
  **/
49
48
  import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
50
- let Table = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_Table = class Table extends Component {
51
- constructor(...args) {
52
- super(...args);
53
- this.ref = null;
54
- // Reference to hidden aria-live region for announcing caption changes to screen readers
55
- this._liveRegionRef = null;
56
- // Timeout for delayed announcement (workaround for Safari/VoiceOver caption update bug)
57
- this._announcementTimeout = void 0;
58
- this.handleRef = el => {
59
- var _this$props$elementRe, _this$props;
60
- this.ref = el;
61
- (_this$props$elementRe = (_this$props = this.props).elementRef) === null || _this$props$elementRe === void 0 ? void 0 : _this$props$elementRe.call(_this$props, el);
62
- };
63
- }
49
+ let Table = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = class Table extends Component {
50
+ static displayName = "Table";
51
+ static componentId = 'Table';
52
+ static allowedProps = allowedProps;
53
+ static defaultProps = {
54
+ children: null,
55
+ hover: false,
56
+ layout: 'auto'
57
+ };
58
+ static Head = Head;
59
+ static Body = Body;
60
+ static Row = Row;
61
+ static ColHeader = ColHeader;
62
+ static RowHeader = RowHeader;
63
+ static Cell = Cell;
64
+ ref = null;
65
+ // Reference to hidden aria-live region for announcing caption changes to screen readers
66
+ _liveRegionRef = null;
67
+ // Timeout for delayed announcement (workaround for Safari/VoiceOver caption update bug)
68
+ _announcementTimeout;
69
+ handleRef = el => {
70
+ this.ref = el;
71
+ this.props.elementRef?.(el);
72
+ };
64
73
  componentDidMount() {
65
- var _this$props$makeStyle, _this$props2;
66
- (_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
74
+ this.props.makeStyles?.();
67
75
  }
68
76
  componentDidUpdate(prevProps) {
69
- var _this$props$makeStyle2, _this$props3;
70
- (_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
77
+ this.props.makeStyles?.();
71
78
  // Announce caption changes for screen readers (especially VoiceOver)
72
79
  // Safari/VoiceOver has a known bug where dynamic <caption> updates aren't announced,
73
80
  // so we use an aria-live region as a workaround
74
81
  const prevSortInfo = this.getSortedHeaderInfo(prevProps);
75
82
  const currentSortInfo = this.getSortedHeaderInfo(this.props);
76
83
  // Only announce if sorting actually changed
77
- const sortingChanged = (prevSortInfo === null || prevSortInfo === void 0 ? void 0 : prevSortInfo.header) !== (currentSortInfo === null || currentSortInfo === void 0 ? void 0 : currentSortInfo.header) || (prevSortInfo === null || prevSortInfo === void 0 ? void 0 : prevSortInfo.direction) !== (currentSortInfo === null || currentSortInfo === void 0 ? void 0 : currentSortInfo.direction);
84
+ const sortingChanged = prevSortInfo?.header !== currentSortInfo?.header || prevSortInfo?.direction !== currentSortInfo?.direction;
78
85
  if (sortingChanged && currentSortInfo && this._liveRegionRef) {
79
86
  // Clear any pending announcement
80
87
  clearTimeout(this._announcementTimeout);
@@ -96,33 +103,24 @@ let Table = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_clas
96
103
  clearTimeout(this._announcementTimeout);
97
104
  }
98
105
  getHeaders() {
99
- const _Children$toArray = Children.toArray(this.props.children),
100
- _Children$toArray2 = _slicedToArray(_Children$toArray, 1),
101
- headChild = _Children$toArray2[0];
102
- if (!headChild || ! /*#__PURE__*/isValidElement(headChild)) return void 0;
103
- const _Children$toArray3 = Children.toArray(headChild.props.children),
104
- _Children$toArray4 = _slicedToArray(_Children$toArray3, 1),
105
- firstRow = _Children$toArray4[0];
106
- if (!firstRow || ! /*#__PURE__*/isValidElement(firstRow)) return void 0;
106
+ const [headChild] = Children.toArray(this.props.children);
107
+ if (!headChild || ! /*#__PURE__*/isValidElement(headChild)) return undefined;
108
+ const [firstRow] = Children.toArray(headChild.props.children);
109
+ if (!firstRow || ! /*#__PURE__*/isValidElement(firstRow)) return undefined;
107
110
  return Children.map(firstRow.props.children, colHeader => {
108
- if (! /*#__PURE__*/isValidElement(colHeader)) return void 0;
111
+ if (! /*#__PURE__*/isValidElement(colHeader)) return undefined;
109
112
  return colHeader.props.children;
110
113
  });
111
114
  }
112
115
  getSortedHeaderInfo(props) {
113
- const _Children$toArray5 = Children.toArray(props.children),
114
- _Children$toArray6 = _slicedToArray(_Children$toArray5, 1),
115
- headChild = _Children$toArray6[0];
116
- const _Children$toArray7 = Children.toArray(/*#__PURE__*/isValidElement(headChild) ? headChild.props.children : []),
117
- _Children$toArray8 = _slicedToArray(_Children$toArray7, 1),
118
- firstRow = _Children$toArray8[0];
116
+ const [headChild] = Children.toArray(props.children);
117
+ const [firstRow] = Children.toArray(/*#__PURE__*/isValidElement(headChild) ? headChild.props.children : []);
119
118
  const colHeaders = Children.toArray(/*#__PURE__*/isValidElement(firstRow) ? firstRow.props.children : []);
120
119
  // Find the column with an active sort direction
121
120
  for (const colHeader of colHeaders) {
122
121
  if (/*#__PURE__*/isValidElement(colHeader) && colHeader.props.sortDirection && colHeader.props.sortDirection !== 'none') {
123
- var _colHeader$props$chil, _colHeader$props$chil2, _colHeader$props$chil3;
124
122
  // Extract header text (may be nested in child components)
125
- const headerText = typeof colHeader.props.children === 'string' ? colHeader.props.children : (_colHeader$props$chil = (_colHeader$props$chil2 = colHeader.props.children) === null || _colHeader$props$chil2 === void 0 ? void 0 : (_colHeader$props$chil3 = _colHeader$props$chil2.props) === null || _colHeader$props$chil3 === void 0 ? void 0 : _colHeader$props$chil3.children) !== null && _colHeader$props$chil !== void 0 ? _colHeader$props$chil : '';
123
+ const headerText = typeof colHeader.props.children === 'string' ? colHeader.props.children : colHeader.props.children?.props?.children ?? '';
126
124
  return {
127
125
  header: headerText,
128
126
  direction: colHeader.props.sortDirection
@@ -139,14 +137,15 @@ let Table = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_clas
139
137
  return caption ? caption + sortText : sortText.trim();
140
138
  }
141
139
  render() {
142
- const _this$props4 = this.props,
143
- margin = _this$props4.margin,
144
- layout = _this$props4.layout,
145
- caption = _this$props4.caption,
146
- children = _this$props4.children,
147
- hover = _this$props4.hover,
148
- styles = _this$props4.styles,
149
- minWidth = _this$props4.minWidth;
140
+ const {
141
+ margin,
142
+ layout,
143
+ caption,
144
+ children,
145
+ hover,
146
+ styles,
147
+ minWidth
148
+ } = this.props;
150
149
  const isStacked = layout === 'stacked';
151
150
  const captionText = this.getCaptionText(this.props);
152
151
  if (!caption) {
@@ -156,7 +155,7 @@ let Table = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_clas
156
155
  value: {
157
156
  isStacked,
158
157
  hover: hover,
159
- headers: isStacked ? this.getHeaders() : void 0
158
+ headers: isStacked ? this.getHeaders() : undefined
160
159
  },
161
160
  children: [_jsx("div", {
162
161
  ref: el => {
@@ -165,7 +164,7 @@ let Table = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_clas
165
164
  "aria-live": "polite",
166
165
  "aria-atomic": "true",
167
166
  role: "status",
168
- css: styles === null || styles === void 0 ? void 0 : styles.liveRegion
167
+ css: styles?.liveRegion
169
168
  }), _jsxs(View
170
169
  // All HTML props, except the ones accepted by `View` and `Table`
171
170
  , {
@@ -174,8 +173,8 @@ let Table = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_clas
174
173
  as: isStacked ? 'div' : 'table',
175
174
  margin: margin,
176
175
  elementRef: this.handleRef,
177
- css: styles === null || styles === void 0 ? void 0 : styles.table,
178
- role: isStacked ? 'table' : void 0,
176
+ css: styles?.table,
177
+ role: isStacked ? 'table' : undefined,
179
178
  "aria-label": captionText,
180
179
  children: [!isStacked && caption && _jsx("caption", {
181
180
  children: _jsx(ScreenReaderContent, {
@@ -187,10 +186,6 @@ let Table = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_clas
187
186
  })]
188
187
  });
189
188
  }
190
- }, _Table.displayName = "Table", _Table.componentId = 'Table', _Table.allowedProps = allowedProps, _Table.defaultProps = {
191
- children: null,
192
- hover: false,
193
- layout: 'auto'
194
- }, _Table.Head = Head, _Table.Body = Body, _Table.Row = Row, _Table.ColHeader = ColHeader, _Table.RowHeader = RowHeader, _Table.Cell = Cell, _Table)) || _class);
189
+ }) || _class);
195
190
  export default Table;
196
191
  export { Table };
@@ -33,7 +33,9 @@
33
33
  * @return {Object} The final style object, which will be used in the component
34
34
  */
35
35
  const generateStyle = (componentTheme, props) => {
36
- const layout = props.layout;
36
+ const {
37
+ layout
38
+ } = props;
37
39
  return {
38
40
  table: {
39
41
  label: 'table',
@@ -28,21 +28,22 @@
28
28
  * @return {Object} The final theme object with the overrides and component variables
29
29
  */
30
30
  const generateComponentTheme = theme => {
31
- var _colors$contrasts, _colors$contrasts2;
32
- const colors = theme.colors,
33
- typography = theme.typography,
34
- themeName = theme.key;
31
+ const {
32
+ colors,
33
+ typography,
34
+ key: themeName
35
+ } = theme;
35
36
  const themeSpecificStyle = {
36
37
  canvas: {
37
38
  color: theme['ic-brand-font-color-dark']
38
39
  }
39
40
  };
40
41
  const componentVariables = {
41
- fontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeMedium,
42
- fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
43
- fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightNormal,
44
- color: colors === null || colors === void 0 ? void 0 : (_colors$contrasts = colors.contrasts) === null || _colors$contrasts === void 0 ? void 0 : _colors$contrasts.grey125125,
45
- background: colors === null || colors === void 0 ? void 0 : (_colors$contrasts2 = colors.contrasts) === null || _colors$contrasts2 === void 0 ? void 0 : _colors$contrasts2.white1010
42
+ fontSize: typography?.fontSizeMedium,
43
+ fontFamily: typography?.fontFamily,
44
+ fontWeight: typography?.fontWeightNormal,
45
+ color: colors?.contrasts?.grey125125,
46
+ background: colors?.contrasts?.white1010
46
47
  };
47
48
  return {
48
49
  ...componentVariables,
@@ -1,4 +1,4 @@
1
- var _dec, _class, _Body;
1
+ var _dec, _class;
2
2
  /*
3
3
  * The MIT License (MIT)
4
4
  *
@@ -37,25 +37,33 @@ id: Table.Body
37
37
  ---
38
38
  **/
39
39
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
40
- let Body = (_dec = withStyle(generateStyle), _dec(_class = (_Body = class Body extends Component {
40
+ let Body = (_dec = withStyle(generateStyle), _dec(_class = class Body extends Component {
41
+ static displayName = "Body";
42
+ static componentId = 'Table.Body';
43
+ static contextType = TableContext;
44
+ static allowedProps = allowedProps;
45
+ static defaultProps = {
46
+ children: null
47
+ };
41
48
  componentDidMount() {
42
- var _this$props$makeStyle, _this$props;
43
- (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
49
+ this.props.makeStyles?.();
44
50
  }
45
51
  componentDidUpdate() {
46
- var _this$props$makeStyle2, _this$props2;
47
- (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
52
+ this.props.makeStyles?.();
48
53
  }
49
54
  render() {
50
- const _this$props3 = this.props,
51
- children = _this$props3.children,
52
- styles = _this$props3.styles;
53
- const isStacked = this.context.isStacked;
55
+ const {
56
+ children,
57
+ styles
58
+ } = this.props;
59
+ const {
60
+ isStacked
61
+ } = this.context;
54
62
  return _jsx(View, {
55
63
  ...View.omitViewProps(omitProps(this.props, Body.allowedProps), Body),
56
64
  as: isStacked ? 'div' : 'tbody',
57
- css: styles === null || styles === void 0 ? void 0 : styles.body,
58
- role: isStacked ? 'rowgroup' : void 0,
65
+ css: styles?.body,
66
+ role: isStacked ? 'rowgroup' : undefined,
59
67
  children: Children.map(children, child => {
60
68
  if (/*#__PURE__*/isValidElement(child)) {
61
69
  return safeCloneElement(child, {
@@ -66,8 +74,6 @@ let Body = (_dec = withStyle(generateStyle), _dec(_class = (_Body = class Body e
66
74
  })
67
75
  });
68
76
  }
69
- }, _Body.displayName = "Body", _Body.componentId = 'Table.Body', _Body.contextType = TableContext, _Body.allowedProps = allowedProps, _Body.defaultProps = {
70
- children: null
71
- }, _Body)) || _class);
77
+ }) || _class);
72
78
  export default Body;
73
79
  export { Body };
@@ -1,4 +1,4 @@
1
- var _dec, _class, _Cell;
1
+ var _dec, _class;
2
2
  /*
3
3
  * The MIT License (MIT)
4
4
  *
@@ -37,32 +37,36 @@ id: Table.Cell
37
37
  ---
38
38
  **/
39
39
  import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
40
- let Cell = (_dec = withStyle(generateStyle), _dec(_class = (_Cell = class Cell extends Component {
40
+ let Cell = (_dec = withStyle(generateStyle), _dec(_class = class Cell extends Component {
41
+ static displayName = "Cell";
42
+ static componentId = 'Table.Cell';
43
+ static contextType = TableContext;
44
+ static allowedProps = allowedProps;
45
+ static defaultProps = {
46
+ textAlign: 'start',
47
+ children: null
48
+ };
41
49
  componentDidMount() {
42
- var _this$props$makeStyle, _this$props;
43
- (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
50
+ this.props.makeStyles?.();
44
51
  }
45
52
  componentDidUpdate() {
46
- var _this$props$makeStyle2, _this$props2;
47
- (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
53
+ this.props.makeStyles?.();
48
54
  }
49
55
  render() {
50
- const _this$props3 = this.props,
51
- children = _this$props3.children,
52
- styles = _this$props3.styles,
53
- header = _this$props3.header;
56
+ const {
57
+ children,
58
+ styles,
59
+ header
60
+ } = this.props;
54
61
  const isStacked = this.context.isStacked;
55
62
  return _jsxs(View, {
56
63
  ...View.omitViewProps(omitProps(this.props, Cell.allowedProps), Cell),
57
64
  as: isStacked ? 'div' : 'td',
58
- css: styles === null || styles === void 0 ? void 0 : styles.cell,
59
- role: isStacked ? 'cell' : void 0,
65
+ css: styles?.cell,
66
+ role: isStacked ? 'cell' : undefined,
60
67
  children: [header && callRenderProp(header), header && ': ', callRenderProp(children)]
61
68
  });
62
69
  }
63
- }, _Cell.displayName = "Cell", _Cell.componentId = 'Table.Cell', _Cell.contextType = TableContext, _Cell.allowedProps = allowedProps, _Cell.defaultProps = {
64
- textAlign: 'start',
65
- children: null
66
- }, _Cell)) || _class);
70
+ }) || _class);
67
71
  export default Cell;
68
72
  export { Cell };
@@ -32,7 +32,9 @@
32
32
  * @return {Object} The final style object, which will be used in the component
33
33
  */
34
34
  const generateStyle = (componentTheme, props) => {
35
- const textAlign = props.textAlign;
35
+ const {
36
+ textAlign
37
+ } = props;
36
38
  return {
37
39
  cell: {
38
40
  label: 'cell',
@@ -1,4 +1,4 @@
1
- var _dec, _class, _ColHeader, _ChevronUpInstUIIcon, _ChevronDownInstUIIco, _ChevronsUpDownInstUI;
1
+ var _dec, _class;
2
2
  /*
3
3
  * The MIT License (MIT)
4
4
  *
@@ -37,61 +37,68 @@ id: Table.ColHeader
37
37
  ---
38
38
  **/
39
39
  import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
40
- let ColHeader = (_dec = withStyle(generateStyle), _dec(_class = (_ColHeader = class ColHeader extends Component {
41
- constructor(...args) {
42
- super(...args);
43
- this.handleClick = event => {
44
- const _this$props = this.props,
45
- id = _this$props.id,
46
- onRequestSort = _this$props.onRequestSort;
47
- onRequestSort && onRequestSort(event, {
48
- id
49
- });
50
- };
51
- }
40
+ let ColHeader = (_dec = withStyle(generateStyle), _dec(_class = class ColHeader extends Component {
41
+ static displayName = "ColHeader";
42
+ static componentId = 'Table.ColHeader';
43
+ static allowedProps = allowedProps;
44
+ static defaultProps = {
45
+ textAlign: 'start',
46
+ sortDirection: 'none',
47
+ children: null,
48
+ scope: 'col'
49
+ };
52
50
  componentDidMount() {
53
- var _this$props$makeStyle, _this$props2;
54
- (_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
51
+ this.props.makeStyles?.();
55
52
  }
56
53
  componentDidUpdate() {
57
- var _this$props$makeStyle2, _this$props3;
58
- (_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
54
+ this.props.makeStyles?.();
59
55
  }
56
+ handleClick = event => {
57
+ const {
58
+ id,
59
+ onRequestSort
60
+ } = this.props;
61
+ onRequestSort && onRequestSort(event, {
62
+ id
63
+ });
64
+ };
60
65
  renderSortArrow() {
61
- const _this$props4 = this.props,
62
- sortDirection = _this$props4.sortDirection,
63
- onRequestSort = _this$props4.onRequestSort;
66
+ const {
67
+ sortDirection,
68
+ onRequestSort
69
+ } = this.props;
64
70
  if (sortDirection === 'ascending') {
65
- return _ChevronUpInstUIIcon || (_ChevronUpInstUIIcon = _jsx(ChevronUpInstUIIcon, {
71
+ return _jsx(ChevronUpInstUIIcon, {
66
72
  color: "infoColor",
67
73
  size: "sm"
68
- }));
74
+ });
69
75
  }
70
76
  if (sortDirection === 'descending') {
71
- return _ChevronDownInstUIIco || (_ChevronDownInstUIIco = _jsx(ChevronDownInstUIIcon, {
77
+ return _jsx(ChevronDownInstUIIcon, {
72
78
  color: "infoColor",
73
79
  size: "sm"
74
- }));
80
+ });
75
81
  }
76
82
  if (onRequestSort) {
77
- return _ChevronsUpDownInstUI || (_ChevronsUpDownInstUI = _jsx(ChevronsUpDownInstUIIcon, {
83
+ return _jsx(ChevronsUpDownInstUIIcon, {
78
84
  color: "baseColor",
79
85
  size: "sm"
80
- }));
86
+ });
81
87
  }
82
- return void 0;
88
+ return undefined;
83
89
  }
84
90
  render() {
85
- const _this$props5 = this.props,
86
- onRequestSort = _this$props5.onRequestSort,
87
- width = _this$props5.width,
88
- children = _this$props5.children,
89
- sortDirection = _this$props5.sortDirection,
90
- scope = _this$props5.scope,
91
- styles = _this$props5.styles;
91
+ const {
92
+ onRequestSort,
93
+ width,
94
+ children,
95
+ sortDirection,
96
+ scope,
97
+ styles
98
+ } = this.props;
92
99
  return _jsxs("th", {
93
100
  ...omitProps(this.props, ColHeader.allowedProps),
94
- css: styles === null || styles === void 0 ? void 0 : styles.colHeader,
101
+ css: styles?.colHeader,
95
102
  style: {
96
103
  width
97
104
  },
@@ -99,19 +106,14 @@ let ColHeader = (_dec = withStyle(generateStyle), _dec(_class = (_ColHeader = cl
99
106
  "aria-sort": sortDirection,
100
107
  children: [onRequestSort && _jsx("button", {
101
108
  onClick: this.handleClick,
102
- css: styles === null || styles === void 0 ? void 0 : styles.button,
109
+ css: styles?.button,
103
110
  children: _jsxs("div", {
104
- css: styles === null || styles === void 0 ? void 0 : styles.buttonContent,
111
+ css: styles?.buttonContent,
105
112
  children: [callRenderProp(children), this.renderSortArrow()]
106
113
  })
107
114
  }), !onRequestSort && children, !onRequestSort && this.renderSortArrow()]
108
115
  });
109
116
  }
110
- }, _ColHeader.displayName = "ColHeader", _ColHeader.componentId = 'Table.ColHeader', _ColHeader.allowedProps = allowedProps, _ColHeader.defaultProps = {
111
- textAlign: 'start',
112
- sortDirection: 'none',
113
- children: null,
114
- scope: 'col'
115
- }, _ColHeader)) || _class);
117
+ }) || _class);
116
118
  export default ColHeader;
117
119
  export { ColHeader };
@@ -33,8 +33,10 @@
33
33
  * @return {Object} The final style object, which will be used in the component
34
34
  */
35
35
  const generateStyle = (componentTheme, props, sharedTokens) => {
36
- const onRequestSort = props.onRequestSort,
37
- textAlign = props.textAlign;
36
+ const {
37
+ onRequestSort,
38
+ textAlign
39
+ } = props;
38
40
  const headerStyle = {
39
41
  color: componentTheme.color,
40
42
  fontSize: componentTheme.fontSize,