@zendeskgarden/react-tables 9.0.0-next.0 → 9.0.0-next.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -33
- package/dist/esm/elements/Body.js +26 -0
- package/dist/esm/elements/Caption.js +26 -0
- package/dist/esm/elements/Cell.js +44 -0
- package/dist/esm/elements/GroupRow.js +33 -0
- package/dist/esm/elements/Head.js +26 -0
- package/dist/esm/elements/HeaderCell.js +39 -0
- package/dist/esm/elements/HeaderRow.js +33 -0
- package/dist/esm/elements/OverflowButton.js +55 -0
- package/dist/esm/elements/Row.js +68 -0
- package/dist/esm/elements/SortableCell.js +55 -0
- package/dist/esm/elements/Table.js +65 -0
- package/dist/esm/index.js +17 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/sort-fill.svg.js +27 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/sort-stroke.svg.js +27 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/overflow-stroke.svg.js +36 -0
- package/dist/esm/styled/StyledBody.js +22 -0
- package/dist/esm/styled/StyledCaption.js +22 -0
- package/dist/esm/styled/StyledCell.js +47 -0
- package/dist/esm/styled/StyledGroupRow.js +31 -0
- package/dist/esm/styled/StyledHead.js +27 -0
- package/dist/esm/styled/StyledHeaderCell.js +44 -0
- package/dist/esm/styled/StyledHeaderRow.js +33 -0
- package/dist/esm/styled/StyledHiddenCell.js +23 -0
- package/dist/esm/styled/StyledOverflowButton.js +51 -0
- package/dist/esm/styled/StyledRow.js +62 -0
- package/dist/esm/styled/StyledSortableButton.js +81 -0
- package/dist/esm/styled/StyledTable.js +25 -0
- package/dist/esm/styled/style-utils.js +16 -0
- package/dist/esm/types/index.js +10 -0
- package/dist/esm/utils/useTableContext.js +17 -0
- package/dist/index.cjs.js +72 -77
- package/dist/typings/elements/Body.d.ts +2 -0
- package/dist/typings/elements/Caption.d.ts +2 -0
- package/dist/typings/elements/Cell.d.ts +2 -0
- package/dist/typings/elements/GroupRow.d.ts +2 -0
- package/dist/typings/elements/Head.d.ts +2 -0
- package/dist/typings/elements/HeaderCell.d.ts +2 -0
- package/dist/typings/elements/HeaderRow.d.ts +2 -0
- package/dist/typings/elements/OverflowButton.d.ts +2 -0
- package/dist/typings/elements/Row.d.ts +2 -0
- package/dist/typings/elements/SortableCell.d.ts +2 -0
- package/dist/typings/elements/Table.d.ts +23 -1
- package/dist/typings/styled/StyledHeaderCell.d.ts +1 -1
- package/package.json +6 -6
- package/dist/index.esm.js +0 -637
package/dist/index.cjs.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
+
*/
|
|
8
7
|
'use strict';
|
|
9
8
|
|
|
10
9
|
var React = require('react');
|
|
@@ -38,25 +37,10 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
|
38
37
|
var styled__default = /*#__PURE__*/_interopDefault(styled);
|
|
39
38
|
var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
|
|
40
39
|
|
|
41
|
-
function _extends$3() {
|
|
42
|
-
_extends$3 = Object.assign ? Object.assign.bind() : function (target) {
|
|
43
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
44
|
-
var source = arguments[i];
|
|
45
|
-
for (var key in source) {
|
|
46
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
47
|
-
target[key] = source[key];
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return target;
|
|
52
|
-
};
|
|
53
|
-
return _extends$3.apply(this, arguments);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
40
|
const COMPONENT_ID$b = 'tables.body';
|
|
57
41
|
const StyledBody = styled__default.default.tbody.attrs({
|
|
58
42
|
'data-garden-id': COMPONENT_ID$b,
|
|
59
|
-
'data-garden-version': '9.0.0-next.
|
|
43
|
+
'data-garden-version': '9.0.0-next.10'
|
|
60
44
|
}).withConfig({
|
|
61
45
|
displayName: "StyledBody",
|
|
62
46
|
componentId: "sc-14ud6y-0"
|
|
@@ -68,7 +52,7 @@ StyledBody.defaultProps = {
|
|
|
68
52
|
const COMPONENT_ID$a = 'tables.caption';
|
|
69
53
|
const StyledCaption = styled__default.default.caption.attrs({
|
|
70
54
|
'data-garden-id': COMPONENT_ID$a,
|
|
71
|
-
'data-garden-version': '9.0.0-next.
|
|
55
|
+
'data-garden-version': '9.0.0-next.10'
|
|
72
56
|
}).withConfig({
|
|
73
57
|
displayName: "StyledCaption",
|
|
74
58
|
componentId: "sc-113y327-0"
|
|
@@ -83,11 +67,11 @@ const getLineHeight = props => {
|
|
|
83
67
|
};
|
|
84
68
|
const StyledTable = styled__default.default.table.attrs({
|
|
85
69
|
'data-garden-id': COMPONENT_ID$9,
|
|
86
|
-
'data-garden-version': '9.0.0-next.
|
|
70
|
+
'data-garden-version': '9.0.0-next.10'
|
|
87
71
|
}).withConfig({
|
|
88
72
|
displayName: "StyledTable",
|
|
89
73
|
componentId: "sc-gje7na-0"
|
|
90
|
-
})(["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 => props.theme
|
|
74
|
+
})(["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 => reactTheming.getColorV8('foreground', 600 , props.theme), props => props.theme.fontSizes.md, props => props.theme.rtl && 'rtl', props => reactTheming.retrieveComponentStyles(COMPONENT_ID$9, props));
|
|
91
75
|
StyledTable.defaultProps = {
|
|
92
76
|
theme: reactTheming.DEFAULT_THEME
|
|
93
77
|
};
|
|
@@ -126,7 +110,7 @@ const sizeStyling = props => {
|
|
|
126
110
|
};
|
|
127
111
|
const StyledCell = styled__default.default.td.attrs({
|
|
128
112
|
'data-garden-id': COMPONENT_ID$8,
|
|
129
|
-
'data-garden-version': '9.0.0-next.
|
|
113
|
+
'data-garden-version': '9.0.0-next.10'
|
|
130
114
|
}).withConfig({
|
|
131
115
|
displayName: "StyledCell",
|
|
132
116
|
componentId: "sc-8hpncx-0"
|
|
@@ -138,17 +122,17 @@ StyledCell.defaultProps = {
|
|
|
138
122
|
const COMPONENT_ID$7 = 'tables.overflow_button';
|
|
139
123
|
const OVERFLOW_BUTTON_SIZE = '2em';
|
|
140
124
|
const colorStyles$1 = props => {
|
|
141
|
-
const hoverBackgroundColor = reactTheming.
|
|
142
|
-
const hoverForegroundColor = reactTheming.
|
|
143
|
-
const activeBackgroundColor = reactTheming.
|
|
144
|
-
const activeForegroundColor = reactTheming.
|
|
125
|
+
const hoverBackgroundColor = reactTheming.getColorV8('primaryHue', 600, props.theme, 0.08);
|
|
126
|
+
const hoverForegroundColor = reactTheming.getColorV8('neutralHue', 700, props.theme);
|
|
127
|
+
const activeBackgroundColor = reactTheming.getColorV8('primaryHue', 600, props.theme, 0.2);
|
|
128
|
+
const activeForegroundColor = reactTheming.getColorV8('neutralHue', 800, props.theme);
|
|
145
129
|
let foregroundColor;
|
|
146
130
|
if (props.isHovered) {
|
|
147
131
|
foregroundColor = hoverForegroundColor;
|
|
148
132
|
} else if (props.isActive) {
|
|
149
133
|
foregroundColor = activeForegroundColor;
|
|
150
134
|
} else {
|
|
151
|
-
foregroundColor = reactTheming.
|
|
135
|
+
foregroundColor = reactTheming.getColorV8('neutralHue', 600, props.theme);
|
|
152
136
|
}
|
|
153
137
|
return styled.css(["color:", ";&:hover{background-color:", ";color:", ";}", " &:active{background-color:", ";color:", ";}"], foregroundColor, hoverBackgroundColor, hoverForegroundColor, reactTheming.focusStyles({
|
|
154
138
|
theme: props.theme,
|
|
@@ -157,7 +141,7 @@ const colorStyles$1 = props => {
|
|
|
157
141
|
};
|
|
158
142
|
const StyledOverflowButton = styled__default.default.button.attrs({
|
|
159
143
|
'data-garden-id': COMPONENT_ID$7,
|
|
160
|
-
'data-garden-version': '9.0.0-next.
|
|
144
|
+
'data-garden-version': '9.0.0-next.10',
|
|
161
145
|
type: 'button'
|
|
162
146
|
}).withConfig({
|
|
163
147
|
displayName: "StyledOverflowButton",
|
|
@@ -178,17 +162,17 @@ const COMPONENT_ID$6 = 'tables.row';
|
|
|
178
162
|
const StyledBaseRow = styled__default.default.tr.withConfig({
|
|
179
163
|
displayName: "StyledRow__StyledBaseRow",
|
|
180
164
|
componentId: "sc-ek66ow-0"
|
|
181
|
-
})(["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} ${reactTheming.
|
|
165
|
+
})(["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} ${reactTheming.getColorV8('neutralHue', 200, props.theme)}`, props => props.isStriped && reactTheming.getColorV8('neutralHue', 100, props.theme));
|
|
182
166
|
StyledBaseRow.defaultProps = {
|
|
183
167
|
theme: reactTheming.DEFAULT_THEME
|
|
184
168
|
};
|
|
185
169
|
const colorStyles = props => {
|
|
186
|
-
const boxShadow = `inset ${props.theme.rtl ? '-' : ''}${props.theme.shadowWidths.md} 0 0 0 ${reactTheming.
|
|
187
|
-
const hoveredBackgroundColor = reactTheming.
|
|
188
|
-
const hoveredBorderColor = reactTheming.
|
|
189
|
-
const selectedBackgroundColor = reactTheming.
|
|
190
|
-
const selectedBorderColor = reactTheming.
|
|
191
|
-
const hoveredSelectedBackgroundColor = reactTheming.
|
|
170
|
+
const boxShadow = `inset ${props.theme.rtl ? '-' : ''}${props.theme.shadowWidths.md} 0 0 0 ${reactTheming.getColorV8('primaryHue', 600, props.theme)}`;
|
|
171
|
+
const hoveredBackgroundColor = reactTheming.getColorV8('primaryHue', 600, props.theme, 0.08);
|
|
172
|
+
const hoveredBorderColor = reactTheming.getColorV8('primaryHue', 200, props.theme);
|
|
173
|
+
const selectedBackgroundColor = reactTheming.getColorV8('primaryHue', 600, props.theme, 0.2);
|
|
174
|
+
const selectedBorderColor = reactTheming.getColorV8('primaryHue', 300, props.theme);
|
|
175
|
+
const hoveredSelectedBackgroundColor = reactTheming.getColorV8('primaryHue', 600, props.theme, 0.28);
|
|
192
176
|
let backgroundColor = undefined;
|
|
193
177
|
let borderColor = undefined;
|
|
194
178
|
let hoverBorderBottomColor = undefined;
|
|
@@ -213,7 +197,7 @@ const colorStyles = props => {
|
|
|
213
197
|
};
|
|
214
198
|
const StyledRow = styled__default.default(StyledBaseRow).attrs(props => ({
|
|
215
199
|
'data-garden-id': COMPONENT_ID$6,
|
|
216
|
-
'data-garden-version': '9.0.0-next.
|
|
200
|
+
'data-garden-version': '9.0.0-next.10',
|
|
217
201
|
tabIndex: props.isReadOnly ? undefined : -1
|
|
218
202
|
})).withConfig({
|
|
219
203
|
displayName: "StyledRow",
|
|
@@ -234,23 +218,23 @@ const getHeaderRowHeight = props => {
|
|
|
234
218
|
};
|
|
235
219
|
const StyledHeaderRow = styled__default.default(StyledBaseRow).attrs({
|
|
236
220
|
'data-garden-id': COMPONENT_ID$5,
|
|
237
|
-
'data-garden-version': '9.0.0-next.
|
|
221
|
+
'data-garden-version': '9.0.0-next.10'
|
|
238
222
|
}).withConfig({
|
|
239
223
|
displayName: "StyledHeaderRow",
|
|
240
224
|
componentId: "sc-16ogvdx-0"
|
|
241
|
-
})(["border-bottom-color:", ";height:", ";vertical-align:bottom;font-weight:", ";", "{opacity:1;margin-top:0;margin-bottom:calc(", " - 1em);}", ";"], props => reactTheming.
|
|
225
|
+
})(["border-bottom-color:", ";height:", ";vertical-align:bottom;font-weight:", ";", "{opacity:1;margin-top:0;margin-bottom:calc(", " - 1em);}", ";"], props => reactTheming.getColorV8('neutralHue', 300, props.theme), getHeaderRowHeight, props => props.theme.fontWeights.semibold, StyledOverflowButton, props => polished.math(`${getHeaderRowHeight(props)} / 2`), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$5, props));
|
|
242
226
|
StyledHeaderRow.defaultProps = {
|
|
243
227
|
theme: reactTheming.DEFAULT_THEME
|
|
244
228
|
};
|
|
245
229
|
|
|
246
230
|
const COMPONENT_ID$4 = 'tables.head';
|
|
247
231
|
const stickyStyles = props => {
|
|
248
|
-
const borderColor = reactTheming.
|
|
249
|
-
return styled.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, props.theme
|
|
232
|
+
const borderColor = reactTheming.getColorV8('neutralHue', 300, props.theme);
|
|
233
|
+
return styled.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, reactTheming.getColorV8('background', 600 , props.theme), StyledHeaderRow);
|
|
250
234
|
};
|
|
251
235
|
const StyledHead = styled__default.default.thead.attrs({
|
|
252
236
|
'data-garden-id': COMPONENT_ID$4,
|
|
253
|
-
'data-garden-version': '9.0.0-next.
|
|
237
|
+
'data-garden-version': '9.0.0-next.10'
|
|
254
238
|
}).withConfig({
|
|
255
239
|
displayName: "StyledHead",
|
|
256
240
|
componentId: "sc-spf23a-0"
|
|
@@ -267,11 +251,11 @@ const sizeStyles$1 = props => {
|
|
|
267
251
|
};
|
|
268
252
|
const StyledGroupRow = styled__default.default(StyledBaseRow).attrs({
|
|
269
253
|
'data-garden-id': COMPONENT_ID$3,
|
|
270
|
-
'data-garden-version': '9.0.0-next.
|
|
254
|
+
'data-garden-version': '9.0.0-next.10'
|
|
271
255
|
}).withConfig({
|
|
272
256
|
displayName: "StyledGroupRow",
|
|
273
257
|
componentId: "sc-mpd0r8-0"
|
|
274
|
-
})(["background-color:", ";", " ", ";"], props => reactTheming.
|
|
258
|
+
})(["background-color:", ";", " ", ";"], props => reactTheming.getColorV8('neutralHue', 100, props.theme), props => sizeStyles$1(props), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props));
|
|
275
259
|
StyledGroupRow.defaultProps = {
|
|
276
260
|
theme: reactTheming.DEFAULT_THEME
|
|
277
261
|
};
|
|
@@ -300,30 +284,30 @@ StyledSortableFillIconWrapper.defaultProps = {
|
|
|
300
284
|
};
|
|
301
285
|
const StyledSortableButton = styled__default.default.button.attrs({
|
|
302
286
|
'data-garden-id': COMPONENT_ID$2,
|
|
303
|
-
'data-garden-version': '9.0.0-next.
|
|
287
|
+
'data-garden-version': '9.0.0-next.10',
|
|
304
288
|
type: 'button'
|
|
305
289
|
}).withConfig({
|
|
306
290
|
displayName: "StyledSortableButton",
|
|
307
291
|
componentId: "sc-2s1dli-3"
|
|
308
292
|
})(["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 => polished.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 => {
|
|
309
293
|
if (props.sort === 'asc') {
|
|
310
|
-
return reactTheming.
|
|
294
|
+
return reactTheming.getColorV8('neutralHue', 600, props.theme);
|
|
311
295
|
} else if (props.sort === 'desc') {
|
|
312
|
-
return reactTheming.
|
|
296
|
+
return reactTheming.getColorV8('neutralHue', 400, props.theme);
|
|
313
297
|
}
|
|
314
298
|
return undefined;
|
|
315
299
|
}, props => {
|
|
316
300
|
if (props.sort === 'asc') {
|
|
317
|
-
return reactTheming.
|
|
301
|
+
return reactTheming.getColorV8('neutralHue', 400, props.theme);
|
|
318
302
|
} else if (props.sort === 'desc') {
|
|
319
|
-
return reactTheming.
|
|
303
|
+
return reactTheming.getColorV8('neutralHue', 600, props.theme);
|
|
320
304
|
}
|
|
321
305
|
return undefined;
|
|
322
|
-
}, reactTheming.SELECTOR_FOCUS_VISIBLE, props => reactTheming.
|
|
306
|
+
}, reactTheming.SELECTOR_FOCUS_VISIBLE, props => reactTheming.getColorV8('primaryHue', 600, props.theme), props => props.sort === undefined && `
|
|
323
307
|
${StyledSortableFillIconWrapper} {
|
|
324
308
|
opacity: 1;
|
|
325
|
-
color: ${reactTheming.
|
|
326
|
-
fill: ${reactTheming.
|
|
309
|
+
color: ${reactTheming.getColorV8('primaryHue', 600, props.theme)};
|
|
310
|
+
fill: ${reactTheming.getColorV8('primaryHue', 600, props.theme)};
|
|
327
311
|
}
|
|
328
312
|
|
|
329
313
|
${StyledSortableStrokeIconWrapper} {
|
|
@@ -331,13 +315,13 @@ const StyledSortableButton = styled__default.default.button.attrs({
|
|
|
331
315
|
}
|
|
332
316
|
`, props => props.sort === 'asc' && `
|
|
333
317
|
${StyledSortableFillIconWrapper} {
|
|
334
|
-
color: ${reactTheming.
|
|
335
|
-
fill: ${reactTheming.
|
|
318
|
+
color: ${reactTheming.getColorV8('primaryHue', 600, props.theme)};
|
|
319
|
+
fill: ${reactTheming.getColorV8('primaryHue', 600, props.theme, 0.25)};
|
|
336
320
|
}
|
|
337
321
|
`, props => props.sort === 'desc' && `
|
|
338
322
|
${StyledSortableFillIconWrapper} {
|
|
339
|
-
color: ${reactTheming.
|
|
340
|
-
fill: ${reactTheming.
|
|
323
|
+
color: ${reactTheming.getColorV8('primaryHue', 600, props.theme, 0.25)};
|
|
324
|
+
fill: ${reactTheming.getColorV8('primaryHue', 600, props.theme)};
|
|
341
325
|
}
|
|
342
326
|
`, props => reactTheming.focusStyles({
|
|
343
327
|
theme: props.theme
|
|
@@ -358,7 +342,7 @@ const sizeStyles = props => {
|
|
|
358
342
|
const StyledHeaderCell = styled__default.default(StyledCell).attrs({
|
|
359
343
|
as: 'th',
|
|
360
344
|
'data-garden-id': COMPONENT_ID$1,
|
|
361
|
-
'data-garden-version': '9.0.0-next.
|
|
345
|
+
'data-garden-version': '9.0.0-next.10'
|
|
362
346
|
}).withConfig({
|
|
363
347
|
displayName: "StyledHeaderCell",
|
|
364
348
|
componentId: "sc-fzagoe-0"
|
|
@@ -378,7 +362,7 @@ StyledHeaderCell.defaultProps = {
|
|
|
378
362
|
const COMPONENT_ID = 'tables.hidden_cell';
|
|
379
363
|
const StyledHiddenCell = styled__default.default.div.attrs({
|
|
380
364
|
'data-garden-id': COMPONENT_ID,
|
|
381
|
-
'data-garden-version': '9.0.0-next.
|
|
365
|
+
'data-garden-version': '9.0.0-next.10'
|
|
382
366
|
}).withConfig({
|
|
383
367
|
displayName: "StyledHiddenCell",
|
|
384
368
|
componentId: "sc-1x454xw-0"
|
|
@@ -387,12 +371,12 @@ StyledHiddenCell.defaultProps = {
|
|
|
387
371
|
theme: reactTheming.DEFAULT_THEME
|
|
388
372
|
};
|
|
389
373
|
|
|
390
|
-
const Body = React.forwardRef((props, ref) => React__namespace.default.createElement(StyledBody,
|
|
374
|
+
const Body = React.forwardRef((props, ref) => React__namespace.default.createElement(StyledBody, Object.assign({
|
|
391
375
|
ref: ref
|
|
392
376
|
}, props)));
|
|
393
377
|
Body.displayName = 'Body';
|
|
394
378
|
|
|
395
|
-
const Caption = React.forwardRef((props, ref) => React__namespace.default.createElement(StyledCaption,
|
|
379
|
+
const Caption = React.forwardRef((props, ref) => React__namespace.default.createElement(StyledCaption, Object.assign({
|
|
396
380
|
ref: ref
|
|
397
381
|
}, props)));
|
|
398
382
|
Caption.displayName = 'Caption';
|
|
@@ -413,7 +397,7 @@ const Cell = React__namespace.default.forwardRef((_ref, ref) => {
|
|
|
413
397
|
const {
|
|
414
398
|
size
|
|
415
399
|
} = useTableContext();
|
|
416
|
-
return React__namespace.default.createElement(StyledCell,
|
|
400
|
+
return React__namespace.default.createElement(StyledCell, Object.assign({
|
|
417
401
|
ref: ref,
|
|
418
402
|
size: size
|
|
419
403
|
}, props), hidden && props.children ? React__namespace.default.createElement(StyledHiddenCell, null, props.children) : props.children);
|
|
@@ -430,14 +414,14 @@ const GroupRow = React.forwardRef((props, ref) => {
|
|
|
430
414
|
const {
|
|
431
415
|
size
|
|
432
416
|
} = useTableContext();
|
|
433
|
-
return React__namespace.default.createElement(StyledGroupRow,
|
|
417
|
+
return React__namespace.default.createElement(StyledGroupRow, Object.assign({
|
|
434
418
|
ref: ref,
|
|
435
419
|
size: size
|
|
436
420
|
}, props));
|
|
437
421
|
});
|
|
438
422
|
GroupRow.displayName = 'GroupRow';
|
|
439
423
|
|
|
440
|
-
const Head = React.forwardRef((props, ref) => React__namespace.default.createElement(StyledHead,
|
|
424
|
+
const Head = React.forwardRef((props, ref) => React__namespace.default.createElement(StyledHead, Object.assign({
|
|
441
425
|
ref: ref
|
|
442
426
|
}, props)));
|
|
443
427
|
Head.displayName = 'Head';
|
|
@@ -450,7 +434,7 @@ const HeaderCell = React.forwardRef((_ref, ref) => {
|
|
|
450
434
|
const {
|
|
451
435
|
size
|
|
452
436
|
} = useTableContext();
|
|
453
|
-
return React__namespace.default.createElement(StyledHeaderCell,
|
|
437
|
+
return React__namespace.default.createElement(StyledHeaderCell, Object.assign({
|
|
454
438
|
ref: ref,
|
|
455
439
|
size: size
|
|
456
440
|
}, props), hidden && props.children ? React__namespace.default.createElement(StyledHiddenCell, null, props.children) : props.children);
|
|
@@ -462,7 +446,7 @@ const HeaderRow = React__namespace.default.forwardRef((props, ref) => {
|
|
|
462
446
|
const {
|
|
463
447
|
size
|
|
464
448
|
} = useTableContext();
|
|
465
|
-
return React__namespace.default.createElement(StyledHeaderRow,
|
|
449
|
+
return React__namespace.default.createElement(StyledHeaderRow, Object.assign({
|
|
466
450
|
ref: ref,
|
|
467
451
|
size: size
|
|
468
452
|
}, props));
|
|
@@ -507,7 +491,7 @@ const OverflowButton = React.forwardRef((_ref, ref) => {
|
|
|
507
491
|
const {
|
|
508
492
|
size
|
|
509
493
|
} = useTableContext();
|
|
510
|
-
return React__namespace.default.createElement(StyledOverflowButton,
|
|
494
|
+
return React__namespace.default.createElement(StyledOverflowButton, Object.assign({
|
|
511
495
|
onFocus: containerUtilities.composeEventHandlers(onFocus, () => {
|
|
512
496
|
setIsFocused(true);
|
|
513
497
|
}),
|
|
@@ -553,7 +537,7 @@ const Row = React.forwardRef((_ref, ref) => {
|
|
|
553
537
|
const onBlurCallback = React.useMemo(() => containerUtilities.composeEventHandlers(onBlur, () => {
|
|
554
538
|
setIsFocused(false);
|
|
555
539
|
}), [onBlur, setIsFocused]);
|
|
556
|
-
return React__namespace.default.createElement(StyledRow,
|
|
540
|
+
return React__namespace.default.createElement(StyledRow, Object.assign({
|
|
557
541
|
onFocus: onFocusCallback,
|
|
558
542
|
onBlur: onBlurCallback,
|
|
559
543
|
size: size,
|
|
@@ -624,10 +608,10 @@ const SortableCell = React.forwardRef((_ref, ref) => {
|
|
|
624
608
|
ariaSortValue = 'descending';
|
|
625
609
|
}
|
|
626
610
|
const SortIcon = sort === undefined ? SvgSortStroke : SvgSortFill;
|
|
627
|
-
return React__namespace.default.createElement(StyledHeaderCell,
|
|
611
|
+
return React__namespace.default.createElement(StyledHeaderCell, Object.assign({
|
|
628
612
|
"aria-sort": ariaSortValue,
|
|
629
613
|
width: width
|
|
630
|
-
}, cellProps), React__namespace.default.createElement(StyledSortableButton,
|
|
614
|
+
}, cellProps), React__namespace.default.createElement(StyledSortableButton, Object.assign({
|
|
631
615
|
sort: sort,
|
|
632
616
|
ref: ref
|
|
633
617
|
}, otherProps), children, React__namespace.default.createElement(StyledSortableStrokeIconWrapper, null, React__namespace.default.createElement(SortIcon, null)), React__namespace.default.createElement(StyledSortableFillIconWrapper, null, React__namespace.default.createElement(SvgSortFill, null))));
|
|
@@ -639,25 +623,36 @@ SortableCell.propTypes = {
|
|
|
639
623
|
width: PropTypes__default.default.oneOfType([PropTypes__default.default.string, PropTypes__default.default.number])
|
|
640
624
|
};
|
|
641
625
|
|
|
642
|
-
const
|
|
626
|
+
const TableComponent = React__namespace.default.forwardRef((props, ref) => {
|
|
643
627
|
const tableContextValue = React.useMemo(() => ({
|
|
644
628
|
size: props.size,
|
|
645
629
|
isReadOnly: props.isReadOnly
|
|
646
630
|
}), [props.size, props.isReadOnly]);
|
|
647
631
|
return React__namespace.default.createElement(TableContext.Provider, {
|
|
648
632
|
value: tableContextValue
|
|
649
|
-
}, React__namespace.default.createElement(StyledTable,
|
|
633
|
+
}, React__namespace.default.createElement(StyledTable, Object.assign({
|
|
650
634
|
ref: ref
|
|
651
635
|
}, props)));
|
|
652
636
|
});
|
|
653
|
-
|
|
654
|
-
|
|
637
|
+
TableComponent.displayName = 'Table';
|
|
638
|
+
TableComponent.defaultProps = {
|
|
655
639
|
size: 'medium'
|
|
656
640
|
};
|
|
657
|
-
|
|
641
|
+
TableComponent.propTypes = {
|
|
658
642
|
size: PropTypes__default.default.oneOf(SIZE),
|
|
659
643
|
isReadOnly: PropTypes__default.default.bool
|
|
660
644
|
};
|
|
645
|
+
const Table = TableComponent;
|
|
646
|
+
Table.Body = Body;
|
|
647
|
+
Table.Caption = Caption;
|
|
648
|
+
Table.Cell = Cell;
|
|
649
|
+
Table.GroupRow = GroupRow;
|
|
650
|
+
Table.Head = Head;
|
|
651
|
+
Table.HeaderCell = HeaderCell;
|
|
652
|
+
Table.HeaderRow = HeaderRow;
|
|
653
|
+
Table.OverflowButton = OverflowButton;
|
|
654
|
+
Table.Row = Row;
|
|
655
|
+
Table.SortableCell = SortableCell;
|
|
661
656
|
|
|
662
657
|
exports.Body = Body;
|
|
663
658
|
exports.Caption = Caption;
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
/**
|
|
9
|
+
* @deprecated use `Table.Body` instead
|
|
10
|
+
*
|
|
9
11
|
* @extends HTMLAttributes<HTMLTableSectionElement>
|
|
10
12
|
*/
|
|
11
13
|
export declare const Body: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
/**
|
|
9
|
+
* @deprecated use `Table.Caption` instead
|
|
10
|
+
*
|
|
9
11
|
* @extends HTMLAttributes<HTMLTableCaptionElement>
|
|
10
12
|
*/
|
|
11
13
|
export declare const Caption: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableCaptionElement> & React.RefAttributes<HTMLTableCaptionElement>>;
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { ICellProps } from '../types';
|
|
9
9
|
/**
|
|
10
|
+
* @deprecated use `Table.Cell` instead
|
|
11
|
+
*
|
|
10
12
|
* @extends TdHTMLAttributes<HTMLTableCellElement>
|
|
11
13
|
*/
|
|
12
14
|
export declare const Cell: React.ForwardRefExoticComponent<ICellProps & React.RefAttributes<HTMLTableCellElement>>;
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
/**
|
|
9
|
+
* @deprecated use `Table.GroupRow` instead
|
|
10
|
+
*
|
|
9
11
|
* @extends HTMLAttributes<HTMLTableRowElement>
|
|
10
12
|
*/
|
|
11
13
|
export declare const GroupRow: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableRowElement> & React.RefAttributes<HTMLTableRowElement>>;
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { IHeadProps } from '../types';
|
|
9
9
|
/**
|
|
10
|
+
* @deprecated use `Table.Head` instead
|
|
11
|
+
*
|
|
10
12
|
* @extends HTMLAttributes<HTMLTableSectionElement>
|
|
11
13
|
*/
|
|
12
14
|
export declare const Head: React.ForwardRefExoticComponent<IHeadProps & React.RefAttributes<HTMLTableSectionElement>>;
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { IHeaderCellProps } from '../types';
|
|
9
9
|
/**
|
|
10
|
+
* @deprecated use `Table.HeaderCell` instead
|
|
11
|
+
*
|
|
10
12
|
* @extends ThHTMLAttributes<HTMLTableCellElement>
|
|
11
13
|
*/
|
|
12
14
|
export declare const HeaderCell: React.ForwardRefExoticComponent<IHeaderCellProps & React.RefAttributes<HTMLTableCellElement>>;
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
/**
|
|
9
|
+
* @deprecated use `Table.HeaderRow` instead
|
|
10
|
+
*
|
|
9
11
|
* @extends HTMLAttributes<HTMLTableRowElement>
|
|
10
12
|
*/
|
|
11
13
|
export declare const HeaderRow: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableRowElement> & React.RefAttributes<HTMLTableRowElement>>;
|
|
@@ -14,6 +14,8 @@ export interface IOverflowButtonProps extends ButtonHTMLAttributes<HTMLButtonEle
|
|
|
14
14
|
isFocused?: boolean;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
+
* @deprecated use `Table.OverflowButton` instead
|
|
18
|
+
*
|
|
17
19
|
* @extends ButtonHTMLAttributes<HTMLButtonElement>
|
|
18
20
|
*/
|
|
19
21
|
export declare const OverflowButton: React.ForwardRefExoticComponent<IOverflowButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { IRowProps } from '../types';
|
|
9
9
|
/**
|
|
10
|
+
* @deprecated use `Table.Row` instead
|
|
11
|
+
*
|
|
10
12
|
* @extends HTMLAttributes<HTMLTableRowElement>
|
|
11
13
|
*/
|
|
12
14
|
export declare const Row: React.ForwardRefExoticComponent<IRowProps & React.RefAttributes<HTMLTableRowElement>>;
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { ISortableCellProps } from '../types';
|
|
9
9
|
/**
|
|
10
|
+
* @deprecated use `Table.SortableCell` instead
|
|
11
|
+
*
|
|
10
12
|
* @extends ButtonHTMLAttributes<HTMLButtonElement>
|
|
11
13
|
*/
|
|
12
14
|
export declare const SortableCell: React.ForwardRefExoticComponent<ISortableCellProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -6,7 +6,29 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { ITableProps } from '../types';
|
|
9
|
+
import { Head } from './Head';
|
|
10
|
+
import { Body } from './Body';
|
|
11
|
+
import { Caption } from './Caption';
|
|
12
|
+
import { Cell } from './Cell';
|
|
13
|
+
import { GroupRow } from './GroupRow';
|
|
14
|
+
import { HeaderCell } from './HeaderCell';
|
|
15
|
+
import { HeaderRow } from './HeaderRow';
|
|
16
|
+
import { OverflowButton } from './OverflowButton';
|
|
17
|
+
import { Row } from './Row';
|
|
18
|
+
import { SortableCell } from './SortableCell';
|
|
19
|
+
export declare const TableComponent: React.ForwardRefExoticComponent<ITableProps & React.RefAttributes<HTMLTableElement>>;
|
|
9
20
|
/**
|
|
10
21
|
* @extends TableHTMLAttributes<HTMLTableElement>
|
|
11
22
|
*/
|
|
12
|
-
export declare const Table: React.ForwardRefExoticComponent<ITableProps & React.RefAttributes<HTMLTableElement
|
|
23
|
+
export declare const Table: React.ForwardRefExoticComponent<ITableProps & React.RefAttributes<HTMLTableElement>> & {
|
|
24
|
+
Body: typeof Body;
|
|
25
|
+
Caption: typeof Caption;
|
|
26
|
+
Cell: typeof Cell;
|
|
27
|
+
GroupRow: typeof GroupRow;
|
|
28
|
+
Head: typeof Head;
|
|
29
|
+
HeaderCell: typeof HeaderCell;
|
|
30
|
+
HeaderRow: typeof HeaderRow;
|
|
31
|
+
OverflowButton: typeof OverflowButton;
|
|
32
|
+
Row: typeof Row;
|
|
33
|
+
SortableCell: typeof SortableCell;
|
|
34
|
+
};
|
|
@@ -10,4 +10,4 @@ export declare const StyledHeaderCell: import("styled-components").StyledCompone
|
|
|
10
10
|
as: string;
|
|
11
11
|
'data-garden-id': string;
|
|
12
12
|
'data-garden-version': string;
|
|
13
|
-
}, "data-garden-id" | "data-garden-version"
|
|
13
|
+
}, "as" | "data-garden-id" | "data-garden-version">;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zendeskgarden/react-tables",
|
|
3
|
-
"version": "9.0.0-next.
|
|
3
|
+
"version": "9.0.0-next.10",
|
|
4
4
|
"description": "Components relating to tables in the Garden Design System",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Zendesk Garden <garden@zendesk.com>",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"url": "https://github.com/zendeskgarden/react-components/issues"
|
|
11
11
|
},
|
|
12
12
|
"main": "dist/index.cjs.js",
|
|
13
|
-
"module": "dist/index.
|
|
13
|
+
"module": "dist/esm/index.js",
|
|
14
14
|
"files": [
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
@@ -27,15 +27,15 @@
|
|
|
27
27
|
"prop-types": "^15.5.7"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@zendeskgarden/react-theming": "
|
|
30
|
+
"@zendeskgarden/react-theming": ">=9.0.0-next",
|
|
31
31
|
"react": ">=16.8.0",
|
|
32
32
|
"react-dom": ">=16.8.0",
|
|
33
|
-
"styled-components": "^
|
|
33
|
+
"styled-components": "^5.3.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/react-beautiful-dnd": "13.1.8",
|
|
37
37
|
"@types/react-window": "1.8.8",
|
|
38
|
-
"@zendeskgarden/react-theming": "^9.0.0-next.
|
|
38
|
+
"@zendeskgarden/react-theming": "^9.0.0-next.10",
|
|
39
39
|
"@zendeskgarden/svg-icons": "7.0.0",
|
|
40
40
|
"react-beautiful-dnd": "13.1.1",
|
|
41
41
|
"react-window": "1.8.10"
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
52
|
"zendeskgarden:src": "src/index.ts",
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "818e6100aa6676af7e972198b82516d330307d60"
|
|
54
54
|
}
|