@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.
- package/CHANGELOG.md +5 -2
- package/es/Table/v1/Body/index.js +21 -15
- package/es/Table/v1/Body/theme.js +9 -8
- package/es/Table/v1/Cell/index.js +20 -16
- package/es/Table/v1/Cell/styles.js +3 -1
- package/es/Table/v1/Cell/theme.js +13 -12
- package/es/Table/v1/ColHeader/index.js +43 -41
- package/es/Table/v1/ColHeader/styles.js +4 -2
- package/es/Table/v1/ColHeader/theme.js +19 -18
- package/es/Table/v1/Head/index.js +34 -34
- package/es/Table/v1/Head/theme.js +9 -8
- package/es/Table/v1/Row/index.js +18 -14
- package/es/Table/v1/Row/styles.js +4 -2
- package/es/Table/v1/Row/theme.js +14 -13
- package/es/Table/v1/RowHeader/index.js +19 -15
- package/es/Table/v1/RowHeader/styles.js +3 -1
- package/es/Table/v1/RowHeader/theme.js +13 -12
- package/es/Table/v1/index.js +50 -55
- package/es/Table/v1/styles.js +3 -1
- package/es/Table/v1/theme.js +10 -9
- package/es/Table/v2/Body/index.js +21 -15
- package/es/Table/v2/Cell/index.js +20 -16
- package/es/Table/v2/Cell/styles.js +3 -1
- package/es/Table/v2/ColHeader/index.js +45 -43
- package/es/Table/v2/ColHeader/styles.js +4 -2
- package/es/Table/v2/Head/index.js +37 -37
- package/es/Table/v2/Row/index.js +18 -14
- package/es/Table/v2/Row/styles.js +4 -2
- package/es/Table/v2/RowHeader/index.js +19 -15
- package/es/Table/v2/RowHeader/styles.js +3 -1
- package/es/Table/v2/index.js +50 -55
- package/es/Table/v2/styles.js +3 -1
- package/lib/Table/v1/Body/index.js +21 -15
- package/lib/Table/v1/Body/theme.js +9 -8
- package/lib/Table/v1/Cell/index.js +20 -16
- package/lib/Table/v1/Cell/styles.js +3 -1
- package/lib/Table/v1/Cell/theme.js +13 -12
- package/lib/Table/v1/ColHeader/index.js +43 -41
- package/lib/Table/v1/ColHeader/styles.js +4 -2
- package/lib/Table/v1/ColHeader/theme.js +19 -18
- package/lib/Table/v1/Head/index.js +35 -35
- package/lib/Table/v1/Head/theme.js +9 -8
- package/lib/Table/v1/Row/index.js +18 -14
- package/lib/Table/v1/Row/styles.js +4 -2
- package/lib/Table/v1/Row/theme.js +14 -13
- package/lib/Table/v1/RowHeader/index.js +19 -15
- package/lib/Table/v1/RowHeader/styles.js +3 -1
- package/lib/Table/v1/RowHeader/theme.js +13 -12
- package/lib/Table/v1/index.js +50 -55
- package/lib/Table/v1/styles.js +3 -1
- package/lib/Table/v1/theme.js +10 -9
- package/lib/Table/v2/Body/index.js +21 -15
- package/lib/Table/v2/Cell/index.js +20 -16
- package/lib/Table/v2/Cell/styles.js +3 -1
- package/lib/Table/v2/ColHeader/index.js +45 -43
- package/lib/Table/v2/ColHeader/styles.js +4 -2
- package/lib/Table/v2/Head/index.js +38 -38
- package/lib/Table/v2/Row/index.js +18 -14
- package/lib/Table/v2/Row/styles.js +4 -2
- package/lib/Table/v2/RowHeader/index.js +19 -15
- package/lib/Table/v2/RowHeader/styles.js +3 -1
- package/lib/Table/v2/index.js +50 -55
- package/lib/Table/v2/styles.js +3 -1
- package/package.json +15 -15
- package/tsconfig.build.tsbuildinfo +1 -1
package/es/Table/v1/Row/theme.js
CHANGED
|
@@ -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
|
-
|
|
32
|
-
|
|
33
|
-
typography
|
|
34
|
-
spacing
|
|
35
|
-
themeName
|
|
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
|
|
43
|
-
fontFamily: typography
|
|
44
|
-
fontWeight: typography
|
|
45
|
-
color: colors
|
|
46
|
-
background: colors
|
|
47
|
-
borderColor: colors
|
|
48
|
-
hoverBorderColor: colors
|
|
49
|
-
padding: `${spacing
|
|
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
|
|
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 =
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
52
|
-
children
|
|
53
|
-
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
|
|
65
|
+
css: styles?.rowHeader,
|
|
59
66
|
scope: "row",
|
|
60
|
-
role: isStacked ? 'rowheader' :
|
|
67
|
+
role: isStacked ? 'rowheader' : undefined,
|
|
61
68
|
children: callRenderProp(children)
|
|
62
69
|
});
|
|
63
70
|
}
|
|
64
|
-
}
|
|
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
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
typography
|
|
34
|
-
spacing
|
|
31
|
+
const {
|
|
32
|
+
colors,
|
|
33
|
+
typography,
|
|
34
|
+
spacing
|
|
35
|
+
} = theme;
|
|
35
36
|
const componentVariables = {
|
|
36
|
-
fontSize: typography
|
|
37
|
-
fontFamily: typography
|
|
38
|
-
fontWeight: typography
|
|
39
|
-
color: colors
|
|
40
|
-
background: colors
|
|
41
|
-
borderColor: colors
|
|
42
|
-
lineHeight: typography
|
|
43
|
-
padding: `${spacing
|
|
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
|
package/es/Table/v1/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
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 =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 =
|
|
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
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
if (!
|
|
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
|
|
111
|
+
if (! /*#__PURE__*/isValidElement(colHeader)) return undefined;
|
|
109
112
|
return colHeader.props.children;
|
|
110
113
|
});
|
|
111
114
|
}
|
|
112
115
|
getSortedHeaderInfo(props) {
|
|
113
|
-
const
|
|
114
|
-
|
|
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 :
|
|
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
|
|
143
|
-
margin
|
|
144
|
-
layout
|
|
145
|
-
caption
|
|
146
|
-
children
|
|
147
|
-
hover
|
|
148
|
-
styles
|
|
149
|
-
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() :
|
|
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
|
|
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
|
|
178
|
-
role: isStacked ? 'table' :
|
|
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
|
-
}
|
|
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 };
|
package/es/Table/v1/styles.js
CHANGED
package/es/Table/v1/theme.js
CHANGED
|
@@ -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
|
-
|
|
32
|
-
|
|
33
|
-
typography
|
|
34
|
-
themeName
|
|
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
|
|
42
|
-
fontFamily: typography
|
|
43
|
-
fontWeight: typography
|
|
44
|
-
color: colors
|
|
45
|
-
background: colors
|
|
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
|
|
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 =
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
51
|
-
children
|
|
52
|
-
styles
|
|
53
|
-
|
|
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
|
|
58
|
-
role: isStacked ? 'rowgroup' :
|
|
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
|
-
}
|
|
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
|
|
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 =
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
51
|
-
children
|
|
52
|
-
styles
|
|
53
|
-
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
|
|
59
|
-
role: isStacked ? 'cell' :
|
|
65
|
+
css: styles?.cell,
|
|
66
|
+
role: isStacked ? 'cell' : undefined,
|
|
60
67
|
children: [header && callRenderProp(header), header && ': ', callRenderProp(children)]
|
|
61
68
|
});
|
|
62
69
|
}
|
|
63
|
-
}
|
|
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
|
|
35
|
+
const {
|
|
36
|
+
textAlign
|
|
37
|
+
} = props;
|
|
36
38
|
return {
|
|
37
39
|
cell: {
|
|
38
40
|
label: 'cell',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _dec, _class
|
|
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 =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
62
|
-
sortDirection
|
|
63
|
-
onRequestSort
|
|
66
|
+
const {
|
|
67
|
+
sortDirection,
|
|
68
|
+
onRequestSort
|
|
69
|
+
} = this.props;
|
|
64
70
|
if (sortDirection === 'ascending') {
|
|
65
|
-
return
|
|
71
|
+
return _jsx(ChevronUpInstUIIcon, {
|
|
66
72
|
color: "infoColor",
|
|
67
73
|
size: "sm"
|
|
68
|
-
})
|
|
74
|
+
});
|
|
69
75
|
}
|
|
70
76
|
if (sortDirection === 'descending') {
|
|
71
|
-
return
|
|
77
|
+
return _jsx(ChevronDownInstUIIcon, {
|
|
72
78
|
color: "infoColor",
|
|
73
79
|
size: "sm"
|
|
74
|
-
})
|
|
80
|
+
});
|
|
75
81
|
}
|
|
76
82
|
if (onRequestSort) {
|
|
77
|
-
return
|
|
83
|
+
return _jsx(ChevronsUpDownInstUIIcon, {
|
|
78
84
|
color: "baseColor",
|
|
79
85
|
size: "sm"
|
|
80
|
-
})
|
|
86
|
+
});
|
|
81
87
|
}
|
|
82
|
-
return
|
|
88
|
+
return undefined;
|
|
83
89
|
}
|
|
84
90
|
render() {
|
|
85
|
-
const
|
|
86
|
-
onRequestSort
|
|
87
|
-
width
|
|
88
|
-
children
|
|
89
|
-
sortDirection
|
|
90
|
-
scope
|
|
91
|
-
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
|
|
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
|
|
109
|
+
css: styles?.button,
|
|
103
110
|
children: _jsxs("div", {
|
|
104
|
-
css: styles
|
|
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
|
-
}
|
|
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
|
|
37
|
-
|
|
36
|
+
const {
|
|
37
|
+
onRequestSort,
|
|
38
|
+
textAlign
|
|
39
|
+
} = props;
|
|
38
40
|
const headerStyle = {
|
|
39
41
|
color: componentTheme.color,
|
|
40
42
|
fontSize: componentTheme.fontSize,
|