@zendeskgarden/react-tables 9.0.0-next.2 → 9.0.0-next.21
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 +50 -0
- package/dist/esm/elements/GroupRow.js +33 -0
- package/dist/esm/elements/Head.js +33 -0
- package/dist/esm/elements/HeaderCell.js +45 -0
- package/dist/esm/elements/HeaderRow.js +33 -0
- package/dist/esm/elements/OverflowButton.js +37 -0
- package/dist/esm/elements/Row.js +76 -0
- package/dist/esm/elements/SortableCell.js +63 -0
- package/dist/esm/elements/Table.js +70 -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-vertical-stroke.svg.js +25 -0
- package/dist/esm/styled/StyledBaseRow.js +46 -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 +47 -0
- package/dist/esm/styled/StyledHead.js +40 -0
- package/dist/esm/styled/StyledHeaderCell.js +44 -0
- package/dist/esm/styled/StyledHeaderRow.js +46 -0
- package/dist/esm/styled/StyledHiddenCell.js +23 -0
- package/dist/esm/styled/StyledOverflowButton.js +26 -0
- package/dist/esm/styled/StyledRow.js +106 -0
- package/dist/esm/styled/StyledSortableButton.js +104 -0
- package/dist/esm/styled/StyledTable.js +28 -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 +438 -308
- 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 +4 -10
- 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/StyledBaseRow.d.ts +11 -0
- package/dist/typings/styled/StyledCell.d.ts +5 -2
- package/dist/typings/styled/StyledGroupRow.d.ts +7 -3
- package/dist/typings/styled/StyledHead.d.ts +1 -1
- package/dist/typings/styled/StyledHeaderCell.d.ts +1 -1
- package/dist/typings/styled/StyledHeaderRow.d.ts +7 -3
- package/dist/typings/styled/StyledOverflowButton.d.ts +7 -9
- package/dist/typings/styled/StyledRow.d.ts +10 -8
- package/dist/typings/styled/StyledSortableButton.d.ts +5 -4
- package/dist/typings/styled/StyledTable.d.ts +4 -6
- package/dist/typings/styled/index.d.ts +1 -1
- package/dist/typings/styled/style-utils.d.ts +1 -1
- package/package.json +9 -8
- package/dist/index.esm.js +0 -637
package/dist/index.cjs.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
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');
|
|
11
10
|
var styled = require('styled-components');
|
|
12
11
|
var reactTheming = require('@zendeskgarden/react-theming');
|
|
13
12
|
var polished = require('polished');
|
|
13
|
+
var reactButtons = require('@zendeskgarden/react-buttons');
|
|
14
14
|
var PropTypes = require('prop-types');
|
|
15
15
|
var containerUtilities = require('@zendeskgarden/container-utilities');
|
|
16
16
|
|
|
@@ -38,25 +38,10 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
|
38
38
|
var styled__default = /*#__PURE__*/_interopDefault(styled);
|
|
39
39
|
var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
|
|
40
40
|
|
|
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
41
|
const COMPONENT_ID$b = 'tables.body';
|
|
57
42
|
const StyledBody = styled__default.default.tbody.attrs({
|
|
58
43
|
'data-garden-id': COMPONENT_ID$b,
|
|
59
|
-
'data-garden-version': '9.0.0-next.
|
|
44
|
+
'data-garden-version': '9.0.0-next.21'
|
|
60
45
|
}).withConfig({
|
|
61
46
|
displayName: "StyledBody",
|
|
62
47
|
componentId: "sc-14ud6y-0"
|
|
@@ -68,7 +53,7 @@ StyledBody.defaultProps = {
|
|
|
68
53
|
const COMPONENT_ID$a = 'tables.caption';
|
|
69
54
|
const StyledCaption = styled__default.default.caption.attrs({
|
|
70
55
|
'data-garden-id': COMPONENT_ID$a,
|
|
71
|
-
'data-garden-version': '9.0.0-next.
|
|
56
|
+
'data-garden-version': '9.0.0-next.21'
|
|
72
57
|
}).withConfig({
|
|
73
58
|
displayName: "StyledCaption",
|
|
74
59
|
componentId: "sc-113y327-0"
|
|
@@ -77,206 +62,212 @@ StyledCaption.defaultProps = {
|
|
|
77
62
|
theme: reactTheming.DEFAULT_THEME
|
|
78
63
|
};
|
|
79
64
|
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
65
|
+
const sizeStyles$4 = _ref => {
|
|
66
|
+
let {
|
|
67
|
+
theme
|
|
68
|
+
} = _ref;
|
|
69
|
+
return styled.css(["border-bottom:", ";vertical-align:top;box-sizing:border-box;"], theme.borders.sm);
|
|
83
70
|
};
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
71
|
+
const colorStyles$5 = _ref2 => {
|
|
72
|
+
let {
|
|
73
|
+
theme,
|
|
74
|
+
$isStriped
|
|
75
|
+
} = _ref2;
|
|
76
|
+
const borderColor = reactTheming.getColor({
|
|
77
|
+
variable: 'border.subtle',
|
|
78
|
+
theme
|
|
79
|
+
});
|
|
80
|
+
const backgroundColor = reactTheming.getColor({
|
|
81
|
+
variable: 'background.subtle',
|
|
82
|
+
transparency: theme.opacity[100],
|
|
83
|
+
light: {
|
|
84
|
+
offset: 300
|
|
85
|
+
},
|
|
86
|
+
dark: {
|
|
87
|
+
offset: -600
|
|
88
|
+
},
|
|
89
|
+
theme
|
|
90
|
+
});
|
|
91
|
+
return styled.css(["border-bottom-color:", ";background-color:", ";"], borderColor, $isStriped && backgroundColor);
|
|
92
|
+
};
|
|
93
|
+
const StyledBaseRow = styled__default.default.tr.withConfig({
|
|
94
|
+
displayName: "StyledBaseRow",
|
|
95
|
+
componentId: "sc-1t4zqg4-0"
|
|
96
|
+
})(["display:table-row;transition:background-color 0.1s ease-in-out;", " ", ""], sizeStyles$4, colorStyles$5);
|
|
97
|
+
StyledBaseRow.defaultProps = {
|
|
92
98
|
theme: reactTheming.DEFAULT_THEME
|
|
93
99
|
};
|
|
94
100
|
|
|
95
101
|
const getRowHeight = props => {
|
|
96
|
-
if (props
|
|
102
|
+
if (props.$size === 'large') {
|
|
97
103
|
return `${props.theme.space.base * 16}px`;
|
|
98
|
-
} else if (props
|
|
104
|
+
} else if (props.$size === 'small') {
|
|
99
105
|
return `${props.theme.space.base * 8}px`;
|
|
100
106
|
}
|
|
101
107
|
return `${props.theme.space.base * 10}px`;
|
|
102
108
|
};
|
|
103
109
|
|
|
104
|
-
const COMPONENT_ID$
|
|
105
|
-
const truncatedStyling$1 = styled.css(["overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"]);
|
|
106
|
-
const sizeStyling = props => {
|
|
107
|
-
let boxSizing = 'border-box';
|
|
108
|
-
let padding;
|
|
109
|
-
let width = props.width;
|
|
110
|
-
let height;
|
|
111
|
-
if (props.hasOverflow) {
|
|
112
|
-
boxSizing = 'content-box';
|
|
113
|
-
width = '2em';
|
|
114
|
-
height = 'inherit';
|
|
115
|
-
padding = props.theme.rtl ? `0 0 0 ${props.theme.space.base}px` : `0 ${props.theme.space.base}px 0 0`;
|
|
116
|
-
} else {
|
|
117
|
-
const paddingVertical = polished.math(`(${getRowHeight(props)} - ${getLineHeight(props)}) / 2`);
|
|
118
|
-
const paddingHorizontal = `${props.theme.space.base * 3}px`;
|
|
119
|
-
padding = `${paddingVertical} ${paddingHorizontal}`;
|
|
120
|
-
}
|
|
121
|
-
if (props.isMinimum) {
|
|
122
|
-
boxSizing = 'content-box';
|
|
123
|
-
width = '1em';
|
|
124
|
-
}
|
|
125
|
-
return styled.css(["box-sizing:", ";padding:", ";width:", ";height:", ";"], boxSizing, padding, width, height);
|
|
126
|
-
};
|
|
127
|
-
const StyledCell = styled__default.default.td.attrs({
|
|
128
|
-
'data-garden-id': COMPONENT_ID$8,
|
|
129
|
-
'data-garden-version': '9.0.0-next.2'
|
|
130
|
-
}).withConfig({
|
|
131
|
-
displayName: "StyledCell",
|
|
132
|
-
componentId: "sc-8hpncx-0"
|
|
133
|
-
})(["display:table-cell;transition:border-color 0.25s ease-in-out,box-shadow 0.1s ease-in-out;", ";", ";", ";"], props => sizeStyling(props), props => props.isTruncated && truncatedStyling$1, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$8, props));
|
|
134
|
-
StyledCell.defaultProps = {
|
|
135
|
-
theme: reactTheming.DEFAULT_THEME
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
const COMPONENT_ID$7 = 'tables.overflow_button';
|
|
110
|
+
const COMPONENT_ID$9 = 'tables.overflow_button';
|
|
139
111
|
const OVERFLOW_BUTTON_SIZE = '2em';
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
const activeBackgroundColor = reactTheming.getColor('primaryHue', 600, props.theme, 0.2);
|
|
144
|
-
const activeForegroundColor = reactTheming.getColor('neutralHue', 800, props.theme);
|
|
145
|
-
let foregroundColor;
|
|
146
|
-
if (props.isHovered) {
|
|
147
|
-
foregroundColor = hoverForegroundColor;
|
|
148
|
-
} else if (props.isActive) {
|
|
149
|
-
foregroundColor = activeForegroundColor;
|
|
150
|
-
} else {
|
|
151
|
-
foregroundColor = reactTheming.getColor('neutralHue', 600, props.theme);
|
|
152
|
-
}
|
|
153
|
-
return styled.css(["color:", ";&:hover{background-color:", ";color:", ";}", " &:active{background-color:", ";color:", ";}"], foregroundColor, hoverBackgroundColor, hoverForegroundColor, reactTheming.focusStyles({
|
|
154
|
-
theme: props.theme,
|
|
155
|
-
inset: true
|
|
156
|
-
}), activeBackgroundColor, activeForegroundColor);
|
|
157
|
-
};
|
|
158
|
-
const StyledOverflowButton = styled__default.default.button.attrs({
|
|
159
|
-
'data-garden-id': COMPONENT_ID$7,
|
|
160
|
-
'data-garden-version': '9.0.0-next.2',
|
|
161
|
-
type: 'button'
|
|
112
|
+
const StyledOverflowButton = styled__default.default(reactButtons.IconButton).attrs({
|
|
113
|
+
'data-garden-id': COMPONENT_ID$9,
|
|
114
|
+
'data-garden-version': '9.0.0-next.21'
|
|
162
115
|
}).withConfig({
|
|
163
116
|
displayName: "StyledOverflowButton",
|
|
164
117
|
componentId: "sc-1eba2ml-0"
|
|
165
|
-
})(["
|
|
118
|
+
})(["margin-top:calc(", " - 1em);width:100%;min-width:unset;height:", ";font-size:inherit;", ";"], props => polished.math(`${getRowHeight(props)} / 2`), OVERFLOW_BUTTON_SIZE, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$9, props));
|
|
166
119
|
StyledOverflowButton.defaultProps = {
|
|
167
120
|
theme: reactTheming.DEFAULT_THEME
|
|
168
121
|
};
|
|
169
|
-
const StyledOverflowButtonIconWrapper = styled__default.default.div.withConfig({
|
|
170
|
-
displayName: "StyledOverflowButton__StyledOverflowButtonIconWrapper",
|
|
171
|
-
componentId: "sc-1eba2ml-1"
|
|
172
|
-
})(["display:flex;align-items:center;justify-content:center;transform:rotate(90deg);transition:background-color 0.1s ease-in-out;width:", ";height:", ";"], OVERFLOW_BUTTON_SIZE, OVERFLOW_BUTTON_SIZE);
|
|
173
|
-
StyledOverflowButtonIconWrapper.defaultProps = {
|
|
174
|
-
theme: reactTheming.DEFAULT_THEME
|
|
175
|
-
};
|
|
176
122
|
|
|
177
|
-
const COMPONENT_ID$
|
|
178
|
-
const StyledBaseRow = styled__default.default.tr.withConfig({
|
|
179
|
-
displayName: "StyledRow__StyledBaseRow",
|
|
180
|
-
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.getColor('neutralHue', 200, props.theme)}`, props => props.isStriped && reactTheming.getColor('neutralHue', 100, props.theme));
|
|
182
|
-
StyledBaseRow.defaultProps = {
|
|
183
|
-
theme: reactTheming.DEFAULT_THEME
|
|
184
|
-
};
|
|
185
|
-
const colorStyles = props => {
|
|
186
|
-
const boxShadow = `inset ${props.theme.rtl ? '-' : ''}${props.theme.shadowWidths.md} 0 0 0 ${reactTheming.getColor('primaryHue', 600, props.theme)}`;
|
|
187
|
-
const hoveredBackgroundColor = reactTheming.getColor('primaryHue', 600, props.theme, 0.08);
|
|
188
|
-
const hoveredBorderColor = reactTheming.getColor('primaryHue', 200, props.theme);
|
|
189
|
-
const selectedBackgroundColor = reactTheming.getColor('primaryHue', 600, props.theme, 0.2);
|
|
190
|
-
const selectedBorderColor = reactTheming.getColor('primaryHue', 300, props.theme);
|
|
191
|
-
const hoveredSelectedBackgroundColor = reactTheming.getColor('primaryHue', 600, props.theme, 0.28);
|
|
192
|
-
let backgroundColor = undefined;
|
|
193
|
-
let borderColor = undefined;
|
|
194
|
-
let hoverBorderBottomColor = undefined;
|
|
195
|
-
let hoverBackgroundColor = undefined;
|
|
196
|
-
if (props.isSelected) {
|
|
197
|
-
if (props.isHovered) {
|
|
198
|
-
backgroundColor = hoveredSelectedBackgroundColor;
|
|
199
|
-
} else {
|
|
200
|
-
backgroundColor = selectedBackgroundColor;
|
|
201
|
-
}
|
|
202
|
-
borderColor = selectedBorderColor;
|
|
203
|
-
hoverBorderBottomColor = selectedBorderColor;
|
|
204
|
-
hoverBackgroundColor = hoveredSelectedBackgroundColor;
|
|
205
|
-
} else if (props.isHovered) {
|
|
206
|
-
backgroundColor = hoveredBackgroundColor;
|
|
207
|
-
borderColor = hoveredBorderColor;
|
|
208
|
-
} else if (!props.isReadOnly) {
|
|
209
|
-
hoverBorderBottomColor = hoveredBorderColor;
|
|
210
|
-
hoverBackgroundColor = hoveredBackgroundColor;
|
|
211
|
-
}
|
|
212
|
-
return styled.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);
|
|
213
|
-
};
|
|
214
|
-
const StyledRow = styled__default.default(StyledBaseRow).attrs(props => ({
|
|
215
|
-
'data-garden-id': COMPONENT_ID$6,
|
|
216
|
-
'data-garden-version': '9.0.0-next.2',
|
|
217
|
-
tabIndex: props.isReadOnly ? undefined : -1
|
|
218
|
-
})).withConfig({
|
|
219
|
-
displayName: "StyledRow",
|
|
220
|
-
componentId: "sc-ek66ow-1"
|
|
221
|
-
})(["height:", ";", " ", ";"], getRowHeight, props => colorStyles(props), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$6, props));
|
|
222
|
-
StyledRow.defaultProps = {
|
|
223
|
-
theme: reactTheming.DEFAULT_THEME
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
const COMPONENT_ID$5 = 'tables.header_row';
|
|
123
|
+
const COMPONENT_ID$8 = 'tables.header_row';
|
|
227
124
|
const getHeaderRowHeight = props => {
|
|
228
|
-
if (props
|
|
125
|
+
if (props.$size === 'large') {
|
|
229
126
|
return `${props.theme.space.base * 18}px`;
|
|
230
|
-
} else if (props
|
|
127
|
+
} else if (props.$size === 'small') {
|
|
231
128
|
return `${props.theme.space.base * 10}px`;
|
|
232
129
|
}
|
|
233
130
|
return `${props.theme.space.base * 12}px`;
|
|
234
131
|
};
|
|
132
|
+
const colorStyles$4 = _ref => {
|
|
133
|
+
let {
|
|
134
|
+
theme
|
|
135
|
+
} = _ref;
|
|
136
|
+
return styled.css(["border-bottom-color:", ";"], reactTheming.getColor({
|
|
137
|
+
variable: 'border.default',
|
|
138
|
+
theme
|
|
139
|
+
}));
|
|
140
|
+
};
|
|
141
|
+
const sizeStyles$3 = props => {
|
|
142
|
+
const rowHeight = getHeaderRowHeight(props);
|
|
143
|
+
return styled.css(["height:", ";vertical-align:bottom;", "{margin-top:0;margin-bottom:calc(", " - 1em);}"], rowHeight, StyledOverflowButton, polished.math(`${rowHeight} / 2`));
|
|
144
|
+
};
|
|
235
145
|
const StyledHeaderRow = styled__default.default(StyledBaseRow).attrs({
|
|
236
|
-
'data-garden-id': COMPONENT_ID$
|
|
237
|
-
'data-garden-version': '9.0.0-next.
|
|
146
|
+
'data-garden-id': COMPONENT_ID$8,
|
|
147
|
+
'data-garden-version': '9.0.0-next.21'
|
|
238
148
|
}).withConfig({
|
|
239
149
|
displayName: "StyledHeaderRow",
|
|
240
150
|
componentId: "sc-16ogvdx-0"
|
|
241
|
-
})(["
|
|
151
|
+
})(["font-weight:", ";", " ", " ", "{opacity:1;}", ";"], props => props.theme.fontWeights.semibold, sizeStyles$3, colorStyles$4, StyledOverflowButton, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$8, props));
|
|
242
152
|
StyledHeaderRow.defaultProps = {
|
|
243
153
|
theme: reactTheming.DEFAULT_THEME
|
|
244
154
|
};
|
|
245
155
|
|
|
246
|
-
const COMPONENT_ID$
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
|
|
156
|
+
const COMPONENT_ID$7 = 'tables.head';
|
|
157
|
+
const colorStyles$3 = _ref => {
|
|
158
|
+
let {
|
|
159
|
+
theme
|
|
160
|
+
} = _ref;
|
|
161
|
+
const borderColor = reactTheming.getColor({
|
|
162
|
+
variable: 'border.default',
|
|
163
|
+
theme
|
|
164
|
+
});
|
|
165
|
+
const backgroundColor = reactTheming.getColor({
|
|
166
|
+
variable: 'background.default',
|
|
167
|
+
theme
|
|
168
|
+
});
|
|
169
|
+
return styled.css(["box-shadow:inset 0 -", " 0 ", ";background-color:", ";& > ", ":last-child{border-bottom-color:transparent;}"], theme.borderWidths.sm, borderColor, backgroundColor, StyledHeaderRow);
|
|
170
|
+
};
|
|
171
|
+
const stickyStyles = () => {
|
|
172
|
+
return styled.css(["position:sticky;top:0;z-index:1;"]);
|
|
250
173
|
};
|
|
251
174
|
const StyledHead = styled__default.default.thead.attrs({
|
|
252
|
-
'data-garden-id': COMPONENT_ID$
|
|
253
|
-
'data-garden-version': '9.0.0-next.
|
|
175
|
+
'data-garden-id': COMPONENT_ID$7,
|
|
176
|
+
'data-garden-version': '9.0.0-next.21'
|
|
254
177
|
}).withConfig({
|
|
255
178
|
displayName: "StyledHead",
|
|
256
179
|
componentId: "sc-spf23a-0"
|
|
257
|
-
})(["", " ", ";"], props => props
|
|
180
|
+
})(["", " ", " ", ";"], props => props.$isSticky && stickyStyles(), colorStyles$3, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$7, props));
|
|
258
181
|
StyledHead.defaultProps = {
|
|
259
182
|
theme: reactTheming.DEFAULT_THEME
|
|
260
183
|
};
|
|
261
184
|
|
|
262
|
-
const COMPONENT_ID$
|
|
263
|
-
const
|
|
185
|
+
const COMPONENT_ID$6 = 'tables.table';
|
|
186
|
+
const getLineHeight = props => {
|
|
187
|
+
return `${props.theme.space.base * 5}px`;
|
|
188
|
+
};
|
|
189
|
+
const StyledTable = styled__default.default.table.attrs({
|
|
190
|
+
'data-garden-id': COMPONENT_ID$6,
|
|
191
|
+
'data-garden-version': '9.0.0-next.21'
|
|
192
|
+
}).withConfig({
|
|
193
|
+
displayName: "StyledTable",
|
|
194
|
+
componentId: "sc-gje7na-0"
|
|
195
|
+
})(["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.getColor({
|
|
196
|
+
variable: 'foreground.default',
|
|
197
|
+
theme: props.theme
|
|
198
|
+
}), props => props.theme.fontSizes.md, props => props.theme.rtl && 'rtl', props => reactTheming.retrieveComponentStyles(COMPONENT_ID$6, props));
|
|
199
|
+
StyledTable.defaultProps = {
|
|
200
|
+
theme: reactTheming.DEFAULT_THEME
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
const COMPONENT_ID$5 = 'tables.cell';
|
|
204
|
+
const truncatedStyling$1 = styled.css(["overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"]);
|
|
205
|
+
const sizeStyling = props => {
|
|
206
|
+
let boxSizing = 'border-box';
|
|
207
|
+
let padding;
|
|
208
|
+
let width = props.width;
|
|
209
|
+
let height;
|
|
210
|
+
if (props.$hasOverflow) {
|
|
211
|
+
boxSizing = 'content-box';
|
|
212
|
+
width = '2em';
|
|
213
|
+
height = 'inherit';
|
|
214
|
+
padding = props.theme.rtl ? `0 0 0 ${props.theme.space.base}px` : `0 ${props.theme.space.base}px 0 0`;
|
|
215
|
+
} else {
|
|
216
|
+
const paddingVertical = polished.math(`(${getRowHeight(props)} - ${getLineHeight(props)}) / 2`);
|
|
217
|
+
const paddingHorizontal = `${props.theme.space.base * 3}px`;
|
|
218
|
+
padding = `${paddingVertical} ${paddingHorizontal}`;
|
|
219
|
+
}
|
|
220
|
+
if (props.$isMinimum) {
|
|
221
|
+
boxSizing = 'content-box';
|
|
222
|
+
width = '1em';
|
|
223
|
+
}
|
|
224
|
+
return styled.css(["box-sizing:", ";padding:", ";width:", ";height:", ";"], boxSizing, padding, width, height);
|
|
225
|
+
};
|
|
226
|
+
const StyledCell = styled__default.default.td.attrs({
|
|
227
|
+
'data-garden-id': COMPONENT_ID$5,
|
|
228
|
+
'data-garden-version': '9.0.0-next.21'
|
|
229
|
+
}).withConfig({
|
|
230
|
+
displayName: "StyledCell",
|
|
231
|
+
componentId: "sc-8hpncx-0"
|
|
232
|
+
})(["display:table-cell;transition:border-color 0.25s ease-in-out,box-shadow 0.1s ease-in-out;", ";", ";", ";"], props => sizeStyling(props), props => props.$isTruncated && truncatedStyling$1, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$5, props));
|
|
233
|
+
StyledCell.defaultProps = {
|
|
234
|
+
theme: reactTheming.DEFAULT_THEME
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
const COMPONENT_ID$4 = 'tables.group_row';
|
|
238
|
+
const colorStyles$2 = _ref => {
|
|
239
|
+
let {
|
|
240
|
+
theme
|
|
241
|
+
} = _ref;
|
|
242
|
+
return styled.css(["background-color:", ";"], reactTheming.getColor({
|
|
243
|
+
variable: 'background.subtle',
|
|
244
|
+
transparency: theme.opacity[100],
|
|
245
|
+
light: {
|
|
246
|
+
offset: 300
|
|
247
|
+
},
|
|
248
|
+
dark: {
|
|
249
|
+
offset: -600
|
|
250
|
+
},
|
|
251
|
+
theme
|
|
252
|
+
}));
|
|
253
|
+
};
|
|
254
|
+
const sizeStyles$2 = props => {
|
|
264
255
|
const height = `${props.theme.space.base * 8}px`;
|
|
265
256
|
const lineHeight = getLineHeight(props);
|
|
266
257
|
return styled.css(["height:", ";line-height:", ";font-size:", ";", "{padding:", " ", "px;}"], height, lineHeight, props.theme.fontSizes.sm, StyledCell, polished.math(`(${height} - ${lineHeight}) / 2`), props.theme.space.base * 3);
|
|
267
258
|
};
|
|
268
259
|
const StyledGroupRow = styled__default.default(StyledBaseRow).attrs({
|
|
269
|
-
'data-garden-id': COMPONENT_ID$
|
|
270
|
-
'data-garden-version': '9.0.0-next.
|
|
260
|
+
'data-garden-id': COMPONENT_ID$4,
|
|
261
|
+
'data-garden-version': '9.0.0-next.21'
|
|
271
262
|
}).withConfig({
|
|
272
263
|
displayName: "StyledGroupRow",
|
|
273
264
|
componentId: "sc-mpd0r8-0"
|
|
274
|
-
})(["
|
|
265
|
+
})(["", " ", " ", ";"], sizeStyles$2, colorStyles$2, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$4, props));
|
|
275
266
|
StyledGroupRow.defaultProps = {
|
|
276
267
|
theme: reactTheming.DEFAULT_THEME
|
|
277
268
|
};
|
|
278
269
|
|
|
279
|
-
const COMPONENT_ID$
|
|
270
|
+
const COMPONENT_ID$3 = 'tables.sortable';
|
|
280
271
|
const StyledBaseIconWrapper = styled__default.default.div.withConfig({
|
|
281
272
|
displayName: "StyledSortableButton__StyledBaseIconWrapper",
|
|
282
273
|
componentId: "sc-2s1dli-0"
|
|
@@ -298,104 +289,219 @@ const StyledSortableFillIconWrapper = styled__default.default(StyledBaseIconWrap
|
|
|
298
289
|
StyledSortableFillIconWrapper.defaultProps = {
|
|
299
290
|
theme: reactTheming.DEFAULT_THEME
|
|
300
291
|
};
|
|
292
|
+
const colorStyles$1 = _ref => {
|
|
293
|
+
let {
|
|
294
|
+
theme,
|
|
295
|
+
$sort
|
|
296
|
+
} = _ref;
|
|
297
|
+
const fgInactive = reactTheming.getColor({
|
|
298
|
+
variable: 'foreground.subtle',
|
|
299
|
+
transparency: theme.opacity[200],
|
|
300
|
+
theme
|
|
301
|
+
});
|
|
302
|
+
const fgActive = reactTheming.getColor({
|
|
303
|
+
variable: 'foreground.subtle',
|
|
304
|
+
theme
|
|
305
|
+
});
|
|
306
|
+
const fgPrimaryActive = reactTheming.getColor({
|
|
307
|
+
variable: 'foreground.primary',
|
|
308
|
+
theme
|
|
309
|
+
});
|
|
310
|
+
const fgPrimaryInactive = reactTheming.getColor({
|
|
311
|
+
variable: 'foreground.primary',
|
|
312
|
+
theme,
|
|
313
|
+
dark: {
|
|
314
|
+
offset: -100
|
|
315
|
+
},
|
|
316
|
+
transparency: theme.opacity[200]
|
|
317
|
+
});
|
|
318
|
+
let color = fgActive;
|
|
319
|
+
let fill = fgActive;
|
|
320
|
+
if ($sort === 'asc') {
|
|
321
|
+
color = fgActive;
|
|
322
|
+
fill = fgInactive;
|
|
323
|
+
} else if ($sort === 'desc') {
|
|
324
|
+
color = fgInactive;
|
|
325
|
+
fill = fgActive;
|
|
326
|
+
}
|
|
327
|
+
return styled.css(["", "{color:", ";fill:", ";}", "{color:", ";fill:", ";}&:hover,", "{color:", ";", ";", " ", "}", ""], StyledSortableStrokeIconWrapper, fgActive, fgActive, StyledSortableFillIconWrapper, color, fill, reactTheming.SELECTOR_FOCUS_VISIBLE, fgPrimaryActive, $sort === undefined && `
|
|
328
|
+
${StyledSortableFillIconWrapper} {
|
|
329
|
+
opacity: 1;
|
|
330
|
+
color: ${fgPrimaryActive};
|
|
331
|
+
fill: ${fgPrimaryActive};
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
${StyledSortableStrokeIconWrapper} {
|
|
335
|
+
opacity: 0;
|
|
336
|
+
}
|
|
337
|
+
`, $sort === 'asc' && `
|
|
338
|
+
${StyledSortableFillIconWrapper} {
|
|
339
|
+
color: ${fgPrimaryActive};
|
|
340
|
+
fill: ${fgPrimaryInactive};
|
|
341
|
+
}
|
|
342
|
+
`, $sort === 'desc' && `
|
|
343
|
+
${StyledSortableFillIconWrapper} {
|
|
344
|
+
color: ${fgPrimaryInactive};
|
|
345
|
+
fill: ${fgPrimaryActive};
|
|
346
|
+
}
|
|
347
|
+
`, reactTheming.focusStyles({
|
|
348
|
+
theme
|
|
349
|
+
}));
|
|
350
|
+
};
|
|
301
351
|
const StyledSortableButton = styled__default.default.button.attrs({
|
|
302
|
-
'data-garden-id': COMPONENT_ID$
|
|
303
|
-
'data-garden-version': '9.0.0-next.
|
|
352
|
+
'data-garden-id': COMPONENT_ID$3,
|
|
353
|
+
'data-garden-version': '9.0.0-next.21',
|
|
304
354
|
type: 'button'
|
|
305
355
|
}).withConfig({
|
|
306
356
|
displayName: "StyledSortableButton",
|
|
307
357
|
componentId: "sc-2s1dli-3"
|
|
308
|
-
})(["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:", ";
|
|
309
|
-
if (props.sort === 'asc') {
|
|
310
|
-
return reactTheming.getColor('neutralHue', 600, props.theme);
|
|
311
|
-
} else if (props.sort === 'desc') {
|
|
312
|
-
return reactTheming.getColor('neutralHue', 400, props.theme);
|
|
313
|
-
}
|
|
314
|
-
return undefined;
|
|
315
|
-
}, props => {
|
|
316
|
-
if (props.sort === 'asc') {
|
|
317
|
-
return reactTheming.getColor('neutralHue', 400, props.theme);
|
|
318
|
-
} else if (props.sort === 'desc') {
|
|
319
|
-
return reactTheming.getColor('neutralHue', 600, props.theme);
|
|
320
|
-
}
|
|
321
|
-
return undefined;
|
|
322
|
-
}, reactTheming.SELECTOR_FOCUS_VISIBLE, props => reactTheming.getColor('primaryHue', 600, props.theme), props => props.sort === undefined && `
|
|
323
|
-
${StyledSortableFillIconWrapper} {
|
|
324
|
-
opacity: 1;
|
|
325
|
-
color: ${reactTheming.getColor('primaryHue', 600, props.theme)};
|
|
326
|
-
fill: ${reactTheming.getColor('primaryHue', 600, props.theme)};
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
${StyledSortableStrokeIconWrapper} {
|
|
330
|
-
opacity: 0;
|
|
331
|
-
}
|
|
332
|
-
`, props => props.sort === 'asc' && `
|
|
333
|
-
${StyledSortableFillIconWrapper} {
|
|
334
|
-
color: ${reactTheming.getColor('primaryHue', 600, props.theme)};
|
|
335
|
-
fill: ${reactTheming.getColor('primaryHue', 600, props.theme, 0.25)};
|
|
336
|
-
}
|
|
337
|
-
`, props => props.sort === 'desc' && `
|
|
338
|
-
${StyledSortableFillIconWrapper} {
|
|
339
|
-
color: ${reactTheming.getColor('primaryHue', 600, props.theme, 0.25)};
|
|
340
|
-
fill: ${reactTheming.getColor('primaryHue', 600, props.theme)};
|
|
341
|
-
}
|
|
342
|
-
`, props => reactTheming.focusStyles({
|
|
343
|
-
theme: props.theme
|
|
344
|
-
}), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props));
|
|
358
|
+
})(["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 => 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, reactTheming.SELECTOR_FOCUS_VISIBLE, colorStyles$1, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props));
|
|
345
359
|
StyledSortableButton.defaultProps = {
|
|
346
360
|
theme: reactTheming.DEFAULT_THEME
|
|
347
361
|
};
|
|
348
362
|
|
|
349
|
-
const COMPONENT_ID$
|
|
363
|
+
const COMPONENT_ID$2 = 'tables.header_cell';
|
|
350
364
|
const truncatedStyling = styled.css(["", "{max-width:100%;overflow:hidden;text-overflow:ellipsis;}"], StyledSortableButton);
|
|
351
|
-
const sizeStyles = props => {
|
|
365
|
+
const sizeStyles$1 = props => {
|
|
352
366
|
let paddingVertical = undefined;
|
|
353
|
-
if (!props
|
|
367
|
+
if (!props.$hasOverflow) {
|
|
354
368
|
paddingVertical = polished.math(`(${getRowHeight(props)} - ${getLineHeight(props)}) / 2`);
|
|
355
369
|
}
|
|
356
370
|
return styled.css(["padding-top:", ";padding-bottom:", ";"], paddingVertical, paddingVertical);
|
|
357
371
|
};
|
|
358
372
|
const StyledHeaderCell = styled__default.default(StyledCell).attrs({
|
|
359
373
|
as: 'th',
|
|
360
|
-
'data-garden-id': COMPONENT_ID$
|
|
361
|
-
'data-garden-version': '9.0.0-next.
|
|
374
|
+
'data-garden-id': COMPONENT_ID$2,
|
|
375
|
+
'data-garden-version': '9.0.0-next.21'
|
|
362
376
|
}).withConfig({
|
|
363
377
|
displayName: "StyledHeaderCell",
|
|
364
378
|
componentId: "sc-fzagoe-0"
|
|
365
379
|
})(["text-align:", ";font-weight:inherit;", " ", " ", ";"], props => {
|
|
366
|
-
if (!props
|
|
380
|
+
if (!props.$hasOverflow) {
|
|
367
381
|
if (props.theme.rtl) {
|
|
368
382
|
return 'right';
|
|
369
383
|
}
|
|
370
384
|
return 'left';
|
|
371
385
|
}
|
|
372
386
|
return undefined;
|
|
373
|
-
}, props => sizeStyles(props), props => props
|
|
387
|
+
}, props => sizeStyles$1(props), props => props.$isTruncated && truncatedStyling, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props));
|
|
374
388
|
StyledHeaderCell.defaultProps = {
|
|
375
389
|
theme: reactTheming.DEFAULT_THEME
|
|
376
390
|
};
|
|
377
391
|
|
|
378
|
-
const COMPONENT_ID = 'tables.hidden_cell';
|
|
392
|
+
const COMPONENT_ID$1 = 'tables.hidden_cell';
|
|
379
393
|
const StyledHiddenCell = styled__default.default.div.attrs({
|
|
380
|
-
'data-garden-id': COMPONENT_ID,
|
|
381
|
-
'data-garden-version': '9.0.0-next.
|
|
394
|
+
'data-garden-id': COMPONENT_ID$1,
|
|
395
|
+
'data-garden-version': '9.0.0-next.21'
|
|
382
396
|
}).withConfig({
|
|
383
397
|
displayName: "StyledHiddenCell",
|
|
384
398
|
componentId: "sc-1x454xw-0"
|
|
385
|
-
})(["", " ", ";"], polished.hideVisually(), props => reactTheming.retrieveComponentStyles(COMPONENT_ID, props));
|
|
399
|
+
})(["", " ", ";"], polished.hideVisually(), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props));
|
|
386
400
|
StyledHiddenCell.defaultProps = {
|
|
387
401
|
theme: reactTheming.DEFAULT_THEME
|
|
388
402
|
};
|
|
389
403
|
|
|
390
|
-
const
|
|
404
|
+
const COMPONENT_ID = 'tables.row';
|
|
405
|
+
const colorStyles = _ref => {
|
|
406
|
+
let {
|
|
407
|
+
theme,
|
|
408
|
+
$isFocused,
|
|
409
|
+
$isSelected,
|
|
410
|
+
$isHovered,
|
|
411
|
+
$isReadOnly
|
|
412
|
+
} = _ref;
|
|
413
|
+
const hoveredBackgroundColor = reactTheming.getColor({
|
|
414
|
+
variable: 'background.primaryEmphasis',
|
|
415
|
+
transparency: theme.opacity[100],
|
|
416
|
+
dark: {
|
|
417
|
+
offset: -100
|
|
418
|
+
},
|
|
419
|
+
theme
|
|
420
|
+
});
|
|
421
|
+
const hoveredBorderColor = reactTheming.getColor({
|
|
422
|
+
variable: 'border.primaryEmphasis',
|
|
423
|
+
transparency: theme.opacity[200],
|
|
424
|
+
dark: {
|
|
425
|
+
offset: -100
|
|
426
|
+
},
|
|
427
|
+
theme
|
|
428
|
+
});
|
|
429
|
+
const selectedBackgroundColor = reactTheming.getColor({
|
|
430
|
+
variable: 'background.primaryEmphasis',
|
|
431
|
+
transparency: theme.opacity[200],
|
|
432
|
+
dark: {
|
|
433
|
+
offset: -100
|
|
434
|
+
},
|
|
435
|
+
theme
|
|
436
|
+
});
|
|
437
|
+
const selectedBorderColor = reactTheming.getColor({
|
|
438
|
+
variable: 'border.primaryEmphasis',
|
|
439
|
+
light: {
|
|
440
|
+
offset: -400
|
|
441
|
+
},
|
|
442
|
+
dark: {
|
|
443
|
+
offset: 300
|
|
444
|
+
},
|
|
445
|
+
theme
|
|
446
|
+
});
|
|
447
|
+
const hoveredSelectedBackgroundColor = reactTheming.getColor({
|
|
448
|
+
variable: 'background.primaryEmphasis',
|
|
449
|
+
transparency: theme.opacity[300],
|
|
450
|
+
dark: {
|
|
451
|
+
offset: -100
|
|
452
|
+
},
|
|
453
|
+
theme
|
|
454
|
+
});
|
|
455
|
+
const boxShadowColor = reactTheming.getColor({
|
|
456
|
+
variable: 'border.primaryEmphasis',
|
|
457
|
+
theme
|
|
458
|
+
});
|
|
459
|
+
const boxShadow = `inset ${theme.rtl ? '-' : ''}${theme.shadowWidths.md} 0 0 0 ${boxShadowColor}`;
|
|
460
|
+
let backgroundColor = undefined;
|
|
461
|
+
let borderColor = undefined;
|
|
462
|
+
let hoverBorderBottomColor = undefined;
|
|
463
|
+
let hoverBackgroundColor = undefined;
|
|
464
|
+
if ($isSelected) {
|
|
465
|
+
if ($isHovered) {
|
|
466
|
+
backgroundColor = hoveredSelectedBackgroundColor;
|
|
467
|
+
} else {
|
|
468
|
+
backgroundColor = selectedBackgroundColor;
|
|
469
|
+
}
|
|
470
|
+
borderColor = selectedBorderColor;
|
|
471
|
+
hoverBorderBottomColor = selectedBorderColor;
|
|
472
|
+
hoverBackgroundColor = hoveredSelectedBackgroundColor;
|
|
473
|
+
} else if ($isHovered) {
|
|
474
|
+
backgroundColor = hoveredBackgroundColor;
|
|
475
|
+
borderColor = hoveredBorderColor;
|
|
476
|
+
} else if (!$isReadOnly) {
|
|
477
|
+
hoverBorderBottomColor = hoveredBorderColor;
|
|
478
|
+
hoverBackgroundColor = hoveredBackgroundColor;
|
|
479
|
+
}
|
|
480
|
+
return styled.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);
|
|
481
|
+
};
|
|
482
|
+
const sizeStyles = props => {
|
|
483
|
+
return styled.css(["height:", ";"], getRowHeight(props));
|
|
484
|
+
};
|
|
485
|
+
const StyledRow = styled__default.default(StyledBaseRow).attrs({
|
|
486
|
+
'data-garden-id': COMPONENT_ID,
|
|
487
|
+
'data-garden-version': '9.0.0-next.21'
|
|
488
|
+
}).withConfig({
|
|
489
|
+
displayName: "StyledRow",
|
|
490
|
+
componentId: "sc-ek66ow-0"
|
|
491
|
+
})(["", " ", " ", ";"], sizeStyles, colorStyles, props => reactTheming.retrieveComponentStyles(COMPONENT_ID, props));
|
|
492
|
+
StyledRow.defaultProps = {
|
|
493
|
+
theme: reactTheming.DEFAULT_THEME
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
const Body = React.forwardRef((props, ref) => React__namespace.default.createElement(StyledBody, Object.assign({
|
|
391
497
|
ref: ref
|
|
392
498
|
}, props)));
|
|
393
|
-
Body.displayName = 'Body';
|
|
499
|
+
Body.displayName = 'Table.Body';
|
|
394
500
|
|
|
395
|
-
const Caption = React.forwardRef((props, ref) => React__namespace.default.createElement(StyledCaption,
|
|
501
|
+
const Caption = React.forwardRef((props, ref) => React__namespace.default.createElement(StyledCaption, Object.assign({
|
|
396
502
|
ref: ref
|
|
397
503
|
}, props)));
|
|
398
|
-
Caption.displayName = 'Caption';
|
|
504
|
+
Caption.displayName = 'Table.Caption';
|
|
399
505
|
|
|
400
506
|
const TableContext = React__namespace.default.createContext({
|
|
401
507
|
size: 'medium',
|
|
@@ -408,17 +514,23 @@ const useTableContext = () => {
|
|
|
408
514
|
const Cell = React__namespace.default.forwardRef((_ref, ref) => {
|
|
409
515
|
let {
|
|
410
516
|
hidden,
|
|
517
|
+
isMinimum,
|
|
518
|
+
isTruncated,
|
|
519
|
+
hasOverflow,
|
|
411
520
|
...props
|
|
412
521
|
} = _ref;
|
|
413
522
|
const {
|
|
414
523
|
size
|
|
415
524
|
} = useTableContext();
|
|
416
|
-
return React__namespace.default.createElement(StyledCell,
|
|
525
|
+
return React__namespace.default.createElement(StyledCell, Object.assign({
|
|
417
526
|
ref: ref,
|
|
418
|
-
size: size
|
|
527
|
+
$size: size,
|
|
528
|
+
$isMinimum: isMinimum,
|
|
529
|
+
$isTruncated: isTruncated,
|
|
530
|
+
$hasOverflow: hasOverflow
|
|
419
531
|
}, props), hidden && props.children ? React__namespace.default.createElement(StyledHiddenCell, null, props.children) : props.children);
|
|
420
532
|
});
|
|
421
|
-
Cell.displayName = 'Cell';
|
|
533
|
+
Cell.displayName = 'Table.Cell';
|
|
422
534
|
Cell.propTypes = {
|
|
423
535
|
isMinimum: PropTypes__default.default.bool,
|
|
424
536
|
isTruncated: PropTypes__default.default.bool,
|
|
@@ -430,48 +542,61 @@ const GroupRow = React.forwardRef((props, ref) => {
|
|
|
430
542
|
const {
|
|
431
543
|
size
|
|
432
544
|
} = useTableContext();
|
|
433
|
-
return React__namespace.default.createElement(StyledGroupRow,
|
|
545
|
+
return React__namespace.default.createElement(StyledGroupRow, Object.assign({
|
|
434
546
|
ref: ref,
|
|
435
|
-
size: size
|
|
547
|
+
$size: size
|
|
436
548
|
}, props));
|
|
437
549
|
});
|
|
438
|
-
GroupRow.displayName = 'GroupRow';
|
|
550
|
+
GroupRow.displayName = 'Table.GroupRow';
|
|
439
551
|
|
|
440
|
-
const Head = React.forwardRef((
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
552
|
+
const Head = React.forwardRef((_ref, ref) => {
|
|
553
|
+
let {
|
|
554
|
+
isSticky,
|
|
555
|
+
...props
|
|
556
|
+
} = _ref;
|
|
557
|
+
return React__namespace.default.createElement(StyledHead, Object.assign({
|
|
558
|
+
ref: ref,
|
|
559
|
+
$isSticky: isSticky
|
|
560
|
+
}, props));
|
|
561
|
+
});
|
|
562
|
+
Head.displayName = 'Table.Head';
|
|
444
563
|
|
|
445
564
|
const HeaderCell = React.forwardRef((_ref, ref) => {
|
|
446
565
|
let {
|
|
447
566
|
hidden,
|
|
567
|
+
isMinimum,
|
|
568
|
+
isTruncated,
|
|
569
|
+
hasOverflow,
|
|
448
570
|
...props
|
|
449
571
|
} = _ref;
|
|
450
572
|
const {
|
|
451
573
|
size
|
|
452
574
|
} = useTableContext();
|
|
453
|
-
return React__namespace.default.createElement(StyledHeaderCell,
|
|
575
|
+
return React__namespace.default.createElement(StyledHeaderCell, Object.assign({
|
|
454
576
|
ref: ref,
|
|
455
|
-
size: size
|
|
577
|
+
$size: size,
|
|
578
|
+
$isMinimum: isMinimum,
|
|
579
|
+
$isTruncated: isTruncated,
|
|
580
|
+
$hasOverflow: hasOverflow
|
|
456
581
|
}, props), hidden && props.children ? React__namespace.default.createElement(StyledHiddenCell, null, props.children) : props.children);
|
|
457
582
|
});
|
|
458
|
-
HeaderCell.displayName = 'HeaderCell';
|
|
583
|
+
HeaderCell.displayName = 'Table.HeaderCell';
|
|
459
584
|
HeaderCell.propTypes = Cell.propTypes;
|
|
460
585
|
|
|
461
586
|
const HeaderRow = React__namespace.default.forwardRef((props, ref) => {
|
|
462
587
|
const {
|
|
463
588
|
size
|
|
464
589
|
} = useTableContext();
|
|
465
|
-
return React__namespace.default.createElement(StyledHeaderRow,
|
|
590
|
+
return React__namespace.default.createElement(StyledHeaderRow, Object.assign({
|
|
466
591
|
ref: ref,
|
|
467
|
-
size: size
|
|
592
|
+
$size: size
|
|
468
593
|
}, props));
|
|
469
594
|
});
|
|
470
|
-
HeaderRow.displayName = 'HeaderRow';
|
|
595
|
+
HeaderRow.displayName = 'Table.HeaderRow';
|
|
471
596
|
|
|
472
|
-
var
|
|
473
|
-
function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : function (
|
|
474
|
-
var
|
|
597
|
+
var _path$2;
|
|
598
|
+
function _extends$2() { return _extends$2 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$2.apply(null, arguments); }
|
|
599
|
+
var SvgOverflowVerticalStroke = function SvgOverflowVerticalStroke(props) {
|
|
475
600
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$2({
|
|
476
601
|
xmlns: "http://www.w3.org/2000/svg",
|
|
477
602
|
width: 16,
|
|
@@ -479,57 +604,33 @@ var SvgOverflowStroke = function SvgOverflowStroke(props) {
|
|
|
479
604
|
focusable: "false",
|
|
480
605
|
viewBox: "0 0 16 16",
|
|
481
606
|
"aria-hidden": "true"
|
|
482
|
-
}, props),
|
|
483
|
-
fill: "currentColor"
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
cx: 8,
|
|
490
|
-
cy: 8,
|
|
491
|
-
r: 1.5
|
|
492
|
-
}), /*#__PURE__*/React__namespace.createElement("circle", {
|
|
493
|
-
cx: 13.5,
|
|
494
|
-
cy: 8,
|
|
495
|
-
r: 1.5
|
|
496
|
-
}))));
|
|
497
|
-
};
|
|
498
|
-
|
|
499
|
-
const OverflowButton = React.forwardRef((_ref, ref) => {
|
|
500
|
-
let {
|
|
501
|
-
onFocus,
|
|
502
|
-
onBlur,
|
|
503
|
-
isFocused: focused,
|
|
504
|
-
...other
|
|
505
|
-
} = _ref;
|
|
506
|
-
const [isFocused, setIsFocused] = React.useState(false);
|
|
607
|
+
}, props), _path$2 || (_path$2 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
608
|
+
fill: "currentColor",
|
|
609
|
+
d: "M9.5 2.5a1.5 1.5 0 11-3 0 1.5 1.5 0 013 0zm0 5.5a1.5 1.5 0 11-3 0 1.5 1.5 0 013 0zm0 5.5a1.5 1.5 0 11-3 0 1.5 1.5 0 013 0z"
|
|
610
|
+
})));
|
|
611
|
+
};
|
|
612
|
+
|
|
613
|
+
const OverflowButton = React.forwardRef((props, ref) => {
|
|
507
614
|
const {
|
|
508
615
|
size
|
|
509
616
|
} = useTableContext();
|
|
510
|
-
return React__namespace.default.createElement(StyledOverflowButton,
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
}),
|
|
514
|
-
onBlur: containerUtilities.composeEventHandlers(onBlur, () => {
|
|
515
|
-
setIsFocused(false);
|
|
516
|
-
}),
|
|
517
|
-
size: size,
|
|
518
|
-
isFocused: typeof focused === 'undefined' ? isFocused : focused,
|
|
617
|
+
return React__namespace.default.createElement(StyledOverflowButton, Object.assign({
|
|
618
|
+
type: "button",
|
|
619
|
+
$size: size,
|
|
519
620
|
ref: ref
|
|
520
|
-
},
|
|
621
|
+
}, props, {
|
|
622
|
+
focusInset: true
|
|
623
|
+
}), React__namespace.default.createElement(SvgOverflowVerticalStroke, null));
|
|
521
624
|
});
|
|
522
|
-
OverflowButton.displayName = 'OverflowButton';
|
|
523
|
-
OverflowButton.propTypes = {
|
|
524
|
-
isHovered: PropTypes__default.default.bool,
|
|
525
|
-
isActive: PropTypes__default.default.bool,
|
|
526
|
-
isFocused: PropTypes__default.default.bool
|
|
527
|
-
};
|
|
625
|
+
OverflowButton.displayName = 'Table.OverflowButton';
|
|
528
626
|
|
|
529
627
|
const Row = React.forwardRef((_ref, ref) => {
|
|
530
628
|
let {
|
|
531
629
|
onFocus,
|
|
532
630
|
onBlur,
|
|
631
|
+
isSelected,
|
|
632
|
+
isStriped,
|
|
633
|
+
isHovered,
|
|
533
634
|
isFocused: focused,
|
|
534
635
|
...otherProps
|
|
535
636
|
} = _ref;
|
|
@@ -553,16 +654,21 @@ const Row = React.forwardRef((_ref, ref) => {
|
|
|
553
654
|
const onBlurCallback = React.useMemo(() => containerUtilities.composeEventHandlers(onBlur, () => {
|
|
554
655
|
setIsFocused(false);
|
|
555
656
|
}), [onBlur, setIsFocused]);
|
|
556
|
-
return React__namespace.default.createElement(StyledRow,
|
|
657
|
+
return React__namespace.default.createElement(StyledRow, Object.assign({
|
|
557
658
|
onFocus: onFocusCallback,
|
|
558
659
|
onBlur: onBlurCallback,
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
660
|
+
ref: ref,
|
|
661
|
+
$size: size,
|
|
662
|
+
$isReadOnly: isReadOnly,
|
|
663
|
+
$isFocused: computedFocused,
|
|
664
|
+
$isHovered: isHovered,
|
|
665
|
+
$isStriped: isStriped,
|
|
666
|
+
$isSelected: isSelected
|
|
667
|
+
}, otherProps, {
|
|
668
|
+
tabIndex: isReadOnly ? undefined : -1
|
|
669
|
+
}));
|
|
564
670
|
});
|
|
565
|
-
Row.displayName = 'Row';
|
|
671
|
+
Row.displayName = 'Table.Row';
|
|
566
672
|
Row.propTypes = {
|
|
567
673
|
isStriped: PropTypes__default.default.bool,
|
|
568
674
|
isFocused: PropTypes__default.default.bool,
|
|
@@ -571,7 +677,7 @@ Row.propTypes = {
|
|
|
571
677
|
};
|
|
572
678
|
|
|
573
679
|
var _path$1;
|
|
574
|
-
function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : function (
|
|
680
|
+
function _extends$1() { return _extends$1 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$1.apply(null, arguments); }
|
|
575
681
|
var SvgSortStroke = function SvgSortStroke(props) {
|
|
576
682
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
|
|
577
683
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -589,7 +695,7 @@ var SvgSortStroke = function SvgSortStroke(props) {
|
|
|
589
695
|
};
|
|
590
696
|
|
|
591
697
|
var _path, _path2;
|
|
592
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
698
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
593
699
|
var SvgSortFill = function SvgSortFill(props) {
|
|
594
700
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
595
701
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -612,11 +718,16 @@ const SORT = ['asc', 'desc'];
|
|
|
612
718
|
const SortableCell = React.forwardRef((_ref, ref) => {
|
|
613
719
|
let {
|
|
614
720
|
sort,
|
|
615
|
-
cellProps,
|
|
721
|
+
cellProps = {},
|
|
616
722
|
width,
|
|
617
723
|
children,
|
|
618
|
-
...
|
|
724
|
+
...sortableButtonProps
|
|
619
725
|
} = _ref;
|
|
726
|
+
const {
|
|
727
|
+
isMinimum,
|
|
728
|
+
isTruncated,
|
|
729
|
+
hasOverflow
|
|
730
|
+
} = cellProps;
|
|
620
731
|
let ariaSortValue = 'none';
|
|
621
732
|
if (sort === 'asc') {
|
|
622
733
|
ariaSortValue = 'ascending';
|
|
@@ -624,40 +735,59 @@ const SortableCell = React.forwardRef((_ref, ref) => {
|
|
|
624
735
|
ariaSortValue = 'descending';
|
|
625
736
|
}
|
|
626
737
|
const SortIcon = sort === undefined ? SvgSortStroke : SvgSortFill;
|
|
627
|
-
return React__namespace.default.createElement(StyledHeaderCell,
|
|
738
|
+
return React__namespace.default.createElement(StyledHeaderCell, Object.assign({
|
|
628
739
|
"aria-sort": ariaSortValue,
|
|
629
|
-
width: width
|
|
630
|
-
|
|
631
|
-
|
|
740
|
+
width: width,
|
|
741
|
+
$isMinimum: isMinimum,
|
|
742
|
+
$isTruncated: isTruncated,
|
|
743
|
+
$hasOverflow: hasOverflow
|
|
744
|
+
}, cellProps), React__namespace.default.createElement(StyledSortableButton, Object.assign({
|
|
745
|
+
$sort: sort,
|
|
632
746
|
ref: ref
|
|
633
|
-
},
|
|
747
|
+
}, sortableButtonProps), 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))));
|
|
634
748
|
});
|
|
635
|
-
SortableCell.displayName = 'SortableCell';
|
|
749
|
+
SortableCell.displayName = 'Table.SortableCell';
|
|
636
750
|
SortableCell.propTypes = {
|
|
637
751
|
sort: PropTypes__default.default.oneOf(SORT),
|
|
638
752
|
cellProps: PropTypes__default.default.any,
|
|
639
753
|
width: PropTypes__default.default.oneOfType([PropTypes__default.default.string, PropTypes__default.default.number])
|
|
640
754
|
};
|
|
641
755
|
|
|
642
|
-
const
|
|
756
|
+
const TableComponent = React__namespace.default.forwardRef((_ref, ref) => {
|
|
757
|
+
let {
|
|
758
|
+
isReadOnly,
|
|
759
|
+
size,
|
|
760
|
+
...props
|
|
761
|
+
} = _ref;
|
|
643
762
|
const tableContextValue = React.useMemo(() => ({
|
|
644
|
-
size:
|
|
645
|
-
isReadOnly:
|
|
646
|
-
}), [
|
|
763
|
+
size: size,
|
|
764
|
+
isReadOnly: isReadOnly
|
|
765
|
+
}), [size, isReadOnly]);
|
|
647
766
|
return React__namespace.default.createElement(TableContext.Provider, {
|
|
648
767
|
value: tableContextValue
|
|
649
|
-
}, React__namespace.default.createElement(StyledTable,
|
|
768
|
+
}, React__namespace.default.createElement(StyledTable, Object.assign({
|
|
650
769
|
ref: ref
|
|
651
770
|
}, props)));
|
|
652
771
|
});
|
|
653
|
-
|
|
654
|
-
|
|
772
|
+
TableComponent.displayName = 'Table';
|
|
773
|
+
TableComponent.defaultProps = {
|
|
655
774
|
size: 'medium'
|
|
656
775
|
};
|
|
657
|
-
|
|
776
|
+
TableComponent.propTypes = {
|
|
658
777
|
size: PropTypes__default.default.oneOf(SIZE),
|
|
659
778
|
isReadOnly: PropTypes__default.default.bool
|
|
660
779
|
};
|
|
780
|
+
const Table = TableComponent;
|
|
781
|
+
Table.Body = Body;
|
|
782
|
+
Table.Caption = Caption;
|
|
783
|
+
Table.Cell = Cell;
|
|
784
|
+
Table.GroupRow = GroupRow;
|
|
785
|
+
Table.Head = Head;
|
|
786
|
+
Table.HeaderCell = HeaderCell;
|
|
787
|
+
Table.HeaderRow = HeaderRow;
|
|
788
|
+
Table.OverflowButton = OverflowButton;
|
|
789
|
+
Table.Row = Row;
|
|
790
|
+
Table.SortableCell = SortableCell;
|
|
661
791
|
|
|
662
792
|
exports.Body = Body;
|
|
663
793
|
exports.Caption = Caption;
|